felipe Wed, 16 Nov 2011 17:41:40 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=319353
Log: - Fixed bug #60099 (__halt_compiler() works in braced namespaces) Bug: https://bugs.php.net/60099 (Closed) __halt_compiler() works in braced namespaces Changed paths: U php/php-src/branches/PHP_5_3/NEWS A php/php-src/branches/PHP_5_3/Zend/tests/bug60099.phpt U php/php-src/branches/PHP_5_3/Zend/zend_compile.c U php/php-src/branches/PHP_5_4/NEWS A php/php-src/branches/PHP_5_4/Zend/tests/bug60099.phpt U php/php-src/branches/PHP_5_4/Zend/zend_compile.c A php/php-src/trunk/Zend/tests/bug60099.phpt U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2011-11-16 17:40:09 UTC (rev 319352) +++ php/php-src/branches/PHP_5_3/NEWS 2011-11-16 17:41:40 UTC (rev 319353) @@ -3,6 +3,7 @@ ?? ??? 2011, PHP 5.3.9 - Core: + . Fixed bug #60099 (__halt_compiler() works in braced namespaces). (Felipe) . Fixed bug #55874 (GCC does not provide __sync_fetch_and_add on some archs). (klightspeed at netspace dot net dot au) . Fixed bug #52624 (tempnam() by-pass open_basedir with nonnexistent Added: php/php-src/branches/PHP_5_3/Zend/tests/bug60099.phpt =================================================================== --- php/php-src/branches/PHP_5_3/Zend/tests/bug60099.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/Zend/tests/bug60099.phpt 2011-11-16 17:41:40 UTC (rev 319353) @@ -0,0 +1,10 @@ +--TEST-- +Bug #60099 (__halt_compiler() works in braced namespaces) +--FILE-- +<?php +namespace foo { + __halt_compiler(); + +?> +--EXPECTF-- +Fatal error: __HALT_COMPILER() can only be used from the outermost scope in %s on line %d Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.c =================================================================== --- php/php-src/branches/PHP_5_3/Zend/zend_compile.c 2011-11-16 17:40:09 UTC (rev 319352) +++ php/php-src/branches/PHP_5_3/Zend/zend_compile.c 2011-11-16 17:41:40 UTC (rev 319353) @@ -3757,6 +3757,11 @@ char *name, *cfilename; char haltoff[] = "__COMPILER_HALT_OFFSET__"; int len, clen; + + if (CG(has_bracketed_namespaces) && CG(in_namespace)) { + zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); + } + cfilename = zend_get_compiled_filename(TSRMLS_C); clen = strlen(cfilename); zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, cfilename, clen, 0); Modified: php/php-src/branches/PHP_5_4/NEWS =================================================================== --- php/php-src/branches/PHP_5_4/NEWS 2011-11-16 17:40:09 UTC (rev 319352) +++ php/php-src/branches/PHP_5_4/NEWS 2011-11-16 17:41:40 UTC (rev 319353) @@ -5,6 +5,7 @@ - Core: . Fixed bug #60227 (header() cannot detect the multi-line header with CR(0x0D)). (rui) + . Fixed bug #60099 (__halt_compiler() works in braced namespaces). (Felipe) . Fixed bug #55874 (GCC does not provide __sync_fetch_and_add on some archs). (klightspeed at netspace dot net dot au) . Fixed bug #52624 (tempnam() by-pass open_basedir with nonexistent Added: php/php-src/branches/PHP_5_4/Zend/tests/bug60099.phpt =================================================================== --- php/php-src/branches/PHP_5_4/Zend/tests/bug60099.phpt (rev 0) +++ php/php-src/branches/PHP_5_4/Zend/tests/bug60099.phpt 2011-11-16 17:41:40 UTC (rev 319353) @@ -0,0 +1,10 @@ +--TEST-- +Bug #60099 (__halt_compiler() works in braced namespaces) +--FILE-- +<?php +namespace foo { + __halt_compiler(); + +?> +--EXPECTF-- +Fatal error: __HALT_COMPILER() can only be used from the outermost scope in %s on line %d Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c =================================================================== --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-11-16 17:40:09 UTC (rev 319352) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-11-16 17:41:40 UTC (rev 319353) @@ -5311,6 +5311,11 @@ char *name, *cfilename; char haltoff[] = "__COMPILER_HALT_OFFSET__"; int len, clen; + + if (CG(has_bracketed_namespaces) && CG(in_namespace)) { + zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); + } + cfilename = zend_get_compiled_filename(TSRMLS_C); clen = strlen(cfilename); zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, cfilename, clen, 0); Added: php/php-src/trunk/Zend/tests/bug60099.phpt =================================================================== --- php/php-src/trunk/Zend/tests/bug60099.phpt (rev 0) +++ php/php-src/trunk/Zend/tests/bug60099.phpt 2011-11-16 17:41:40 UTC (rev 319353) @@ -0,0 +1,10 @@ +--TEST-- +Bug #60099 (__halt_compiler() works in braced namespaces) +--FILE-- +<?php +namespace foo { + __halt_compiler(); + +?> +--EXPECTF-- +Fatal error: __HALT_COMPILER() can only be used from the outermost scope in %s on line %d Modified: php/php-src/trunk/Zend/zend_compile.c =================================================================== --- php/php-src/trunk/Zend/zend_compile.c 2011-11-16 17:40:09 UTC (rev 319352) +++ php/php-src/trunk/Zend/zend_compile.c 2011-11-16 17:41:40 UTC (rev 319353) @@ -5311,6 +5311,11 @@ char *name, *cfilename; char haltoff[] = "__COMPILER_HALT_OFFSET__"; int len, clen; + + if (CG(has_bracketed_namespaces) && CG(in_namespace)) { + zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); + } + cfilename = zend_get_compiled_filename(TSRMLS_C); clen = strlen(cfilename); zend_mangle_property_name(&name, &len, haltoff, sizeof(haltoff) - 1, cfilename, clen, 0);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php