Edit report at https://bugs.php.net/bug.php?id=60724&edit=1
ID: 60724 User updated by: nicolas dot grekas+php at gmail dot com Reported by: nicolas dot grekas+php at gmail dot com Summary: Includes fails at compile time when using bracketed namespaces Status: Open Type: Bug Package: Scripting Engine problem -PHP Version: 5.4.0RC5 +PHP Version: 5.4.4 Block user comment: N Private report: N New Comment: The bug is still there is the latest version of PHP Previous Comments: ------------------------------------------------------------------------ [2012-01-12 10:25:09] nicolas dot grekas+php at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=60724&edit=1