mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
- Fixed bug #60099 (__halt_compiler() works in braced namespaces)
This commit is contained in:
parent
48b853c82f
commit
7735ef1c2d
1
NEWS
1
NEWS
@ -3,6 +3,7 @@ PHP NEWS
|
||||
?? ??? 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
|
||||
|
10
Zend/tests/bug60099.phpt
Normal file
10
Zend/tests/bug60099.phpt
Normal file
@ -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
|
@ -3757,6 +3757,11 @@ void zend_do_halt_compiler_register(TSRMLS_D) /* {{{ */
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user