summaryrefslogtreecommitdiff
path: root/Zend/zend_constants.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-11-13 18:46:11 +0000
committerFelipe Pena <felipe@php.net>2010-11-13 18:46:11 +0000
commitb5b059939814275ea389c04c61423a21a01c0d69 (patch)
treeb25677b7fada996915ae42912a991cde06a75a19 /Zend/zend_constants.c
parentd475703660e16255509d667e9c5f87fee50f1aaf (diff)
downloadphp-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.c11
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)) {