diff options
author | Felipe Pena <felipe@php.net> | 2010-11-13 18:46:11 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2010-11-13 18:46:11 +0000 |
commit | b5b059939814275ea389c04c61423a21a01c0d69 (patch) | |
tree | b25677b7fada996915ae42912a991cde06a75a19 /Zend/zend_constants.c | |
parent | d475703660e16255509d667e9c5f87fee50f1aaf (diff) | |
download | php-git-b5b059939814275ea389c04c61423a21a01c0d69.tar.gz |
- Fixed bug #53305 (E_NOTICE when defining a constant starts with __COMPILER_HALT_OFFSET__)
- Fixed a part of bug #53260 (the __COMPILER_HALT_OFFSET__ name is not shown in the E_NOTICE)
Diffstat (limited to 'Zend/zend_constants.c')
-rw-r--r-- | Zend/zend_constants.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 04452e40dd..b566146af0 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -473,8 +473,15 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC) } } - if ((strncmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1) == 0) || - zend_hash_add(EG(zend_constants), name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { + /* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */ + if ((c->name_len == sizeof("__COMPILER_HALT_OFFSET__") + && !memcmp(name, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) + || zend_hash_add(EG(zend_constants), name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { + + /* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */ + if (strncmp(name+1, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")) == 0) { + name++; + } zend_error(E_NOTICE,"Constant %s already defined", name); str_free(c->name); if (!(c->flags & CONST_PERSISTENT)) { |