From: Operating system: PHP version: 5.4.0RC5 Package: Scripting Engine problem Bug Type: Bug Bug description:Includes fails at compile time when using bracketed namespaces
Description: ------------ Tested in 5.3.8, 5.2.9 and 5.4RC5, APC not enabled. At compile time, two nested includes fail when both use bracketed namespaces or mix bracketed and unbracketed ones. The compile time behavior of PHP is described in: https://bugs.php.net/bug.php?id=42098 I found a workaround that makes me think that some internal state is not initialized correctly when using namespaces. See test script for more details. Test script: --------------- <?php // This test script uses eval, but the same arise when including files. error_reporting(E_ALL | E_STRICT); set_error_handler('eh'); // The code in the eval triggers an E_DEPRECATED because of "=& new" // so eh() is called to handle the error, _at_compile_time_. // Note the unbracketed namespace declaration. eval('namespace b; $a =& new \stdClass; '); function eh() { // dynamically load class a\abc, // using bracketed namespace declaration // but this fails with fatal error. // uncomment the following line, and things work again perfectly. //eval(';'); eval('namespace a{ class abc{} }'); print_r(new a\abc); } Expected result: ---------------- No error Actual result: -------------- Fatal error: Cannot mix bracketed namespace declarations with unbracketed namespace declarations -- Edit bug report at https://bugs.php.net/bug.php?id=60724&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60724&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60724&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60724&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60724&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60724&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60724&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60724&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60724&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60724&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60724&r=support Expected behavior: https://bugs.php.net/fix.php?id=60724&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60724&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60724&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60724&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60724&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60724&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60724&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60724&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60724&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60724&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60724&r=mysqlcfg