Fibers still start with error_reporting = 0 when the directive is unset
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 73/100
Direzione di ricerca
Start with zend_fiber_execute() in Zend/zend_fibers.c and the error_reporting directive registration in Zend/zend.c; the issue traces how an unset directive becomes level 0. Read the existing gh23921.phpt test and check how the proposed child-process test runs PHP with -n. Done means a regression test covers the unset case and a fiber inherits the expected default level, 30719.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
This is the case from #23921, which was closed by 3bb50c13a7a but still reproduces. When the error_reporting directive is unset, a fiber starts at level 0, so warnings raised inside it are silently dropped. The official Docker images load no php.ini by default, so there it happens without any flags.
The following code:
<?php
echo error_reporting(), "\n";
echo $main;
(new Fiber(function () {
echo error_reporting(), "\n";
echo $fiber;
}))->start();
Run with no flags on php:8.6-rc-cli-alpine. php -n gives the same levels.
Resulted in this output:
30719
Warning: Undefined variable $main in /in/test.php on line 3
0
But I expected this output instead, which is what 8.5.12 prints:
30719
Warning: Undefined variable $main in /in/test.php on line 3
30719
Warning: Undefined variable $fiber in /in/test.php on line 6
Setting the directive explicitly avoids the bug: with -d error_reporting=30719, 8.6 prints 30719 in both places.
Cause
zend_fiber_execute() reads zend_ini_long_literal("error_reporting") (Zend/zend_fibers.c:608). The directive is registered with a NULL default (Zend/zend.c:266), and zend_ini_long() returns 0 for a NULL value (Zend/zend_ini.c:468). 3bb50c13a7a removed the fallback to E_ALL that used to follow that read.
Line numbers are from PHP-8.6. master has the same code.
Why gh23921.phpt doesn't catch it
The test runs with the directive set, not unset. run-tests.php:274 passes error_reporting= with E_ALL to every test, and that is the value the test expects. So it passes with or without the bug:
| Build | gh23921.phpt under run-tests |
Fiber level with php -n |
|---|---|---|
| 8.5.12 | PASS | 30719 |
| 8.6.0RC2, before 3bb50c13a7a | PASS | 0 |
| 8.6.0RC4, after 3bb50c13a7a | PASS | 0 |
--INI-- error_reporting= can't reach this case either. It sets an empty string rather than leaving the directive unset, and -d error_reporting= prints 0 0 on 8.5.12 too.
A test needs a child process started with -n. This one fails on RC2 and RC4 and passes on 8.5.12:
--TEST--
A fiber starts at the default error_reporting when the directive is unset
--FILE--
<?php
$code = <<<'PHP'
echo error_reporting(), "\n";
(new Fiber(function () {
echo error_reporting(), "\n";
}))->start();
PHP;
echo shell_exec(escapeshellarg(getenv('TEST_PHP_EXECUTABLE')) . ' -n -r ' . escapeshellarg($code));
?>
--EXPECT--
30719
30719
PHP Version
PHP 8.6.0RC4 (cli) (built: Nov 5 2026 20:30:28) (ZTS)
Copyright © The PHP Group and Contributors
Built by https://github.com/docker-library/php
Zend Engine v4.6.0RC4, Copyright © Zend by Perforce
with Zend OPcache v8.6.0RC4, Copyright ©, by Zend by Perforce
Also reproduced with php -n on 8.6.0RC5.
Operating System
Alpine Linux 3.24 (official Docker image, aarch64)
- Lingua principale
- C
- Stelle
- 41.8k
- Fork
- 8.6k
- Merge medio
- 2g 15h
- PR unite (30g)
- 125
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di php/php-src
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
ext/openssl: 8.2.31+/8.3.31+ fail to build against OpenSSL 1.0.2 (ASN1_STRING_get0_data in xp_ssl.c)ApertaExtension: openssl Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
php/php-src#25402 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
php/php-src#25397 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
SNMP accepts malformed remote portsForse già presa @somethingwithproof l’ha presa 21 giorni fa. Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
php/php-src#25137 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
ZIP/ZIPS decode dereferences NULL when the cached libdeflate decompressor can't be allocated (3.5 regression)Forse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
AcademySoftwareFoundation/openexr#2884 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
python-pillow/Pillow#10590 ·
I maintainer di solito rispondono entro 1 giorno
-
status: needs-triage type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
openwrt/packages#31407 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno