diff options
| -rw-r--r-- | Zend/tests/bug42798.phpt | 15 | ||||
| -rw-r--r-- | Zend/zend_constants.c | 6 | ||||
| -rw-r--r-- | Zend/zend_execute_API.c | 3 |
3 files changed, 21 insertions, 3 deletions
diff --git a/Zend/tests/bug42798.phpt b/Zend/tests/bug42798.phpt new file mode 100644 index 0000000000..1c45867722 --- /dev/null +++ b/Zend/tests/bug42798.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #42798 (_autoload() not triggered for classes used in method signature) +--FILE-- +<?php +function __autoload($className) { + print "$className\n"; + exit(); +} + +function foo($c = ok::constant) { +} + +foo(); +--EXPECT-- +ok diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 06b25c3a20..14bdf6a94a 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -434,8 +434,10 @@ ZEND_API int zend_u_get_constant_ex(zend_uchar type, zstr name, uint name_len, z } efree(lcname.v); - /* Check for class */ - ce = zend_u_fetch_class(type, class_name, class_name_len, flags TSRMLS_CC); + if ((flags & IS_CONSTANT_RT_NS_CHECK) == 0) { + /* Check for class */ + ce = zend_u_fetch_class(type, class_name, class_name_len, flags TSRMLS_CC); + } } if (retval && ce) { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 245ed90080..3e2ba09ed3 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -478,6 +478,7 @@ ZEND_API int zend_is_true(zval *op) /* {{{ */ #define IS_VISITED_CONSTANT IS_CONSTANT_INDEX #define IS_CONSTANT_VISITED(p) (Z_TYPE_P(p) & IS_VISITED_CONSTANT) +#define Z_REAL_TYPE_P(p) (Z_TYPE_P(p) & ~IS_VISITED_CONSTANT) #define MARK_CONSTANT_VISITED(p) Z_TYPE_P(p) |= IS_VISITED_CONSTANT ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC) /* {{{ */ @@ -501,7 +502,7 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco refcount = p->refcount; is_ref = p->is_ref; - if (!zend_u_get_constant_ex(ZEND_STR_TYPE, Z_UNIVAL_P(p), Z_UNILEN_P(p), &const_value, scope, Z_TYPE_P(p) TSRMLS_CC)) { + if (!zend_u_get_constant_ex(ZEND_STR_TYPE, Z_UNIVAL_P(p), Z_UNILEN_P(p), &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) { if ((UG(unicode) && (colon.u = u_memrchr(Z_USTRVAL_P(p), ':', Z_USTRLEN_P(p))) && colon.u > Z_USTRVAL_P(p) && *(colon.u-1) == ':') || (!UG(unicode) && (colon.s = zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p))) && colon.s > Z_STRVAL_P(p) && *(colon.s-1) == ':')) { if (UG(unicode)) { |
