php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | |
Patch zend_do_fetch_constant for Class/Object related Bug #63976Patch version 2013-03-19 09:59 UTC Return to Bug #63976 | Download this patchThis patch renders other patches obsolete Obsolete patches: Patch Revisions:Developer: mike@php.netdiff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1a8d108..633a771 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5568,11 +5568,22 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con /* this is a class constant */ type = zend_get_class_fetch_type(Z_STRVAL(constant_container->u.constant), Z_STRLEN(constant_container->u.constant)); - if (ZEND_FETCH_CLASS_STATIC == type) { + switch (type) { + case ZEND_FETCH_CLASS_STATIC: zend_error(E_ERROR, "\"static::\" is not allowed in compile-time constants"); - } else if (ZEND_FETCH_CLASS_DEFAULT == type) { + break; + case ZEND_FETCH_CLASS_DEFAULT: zend_resolve_class_name(constant_container, fetch_type, 1 TSRMLS_CC); + break; + case ZEND_FETCH_CLASS_SELF: + if (CG(active_class_entry)) { + Z_STRVAL(constant_container->u.constant) = erealloc(Z_STRVAL(constant_container->u.constant), CG(active_class_entry)->name_length + 1); + memcpy(Z_STRVAL(constant_container->u.constant), CG(active_class_entry)->name, CG(active_class_entry)->name_length + 1); + Z_STRLEN(constant_container->u.constant) = CG(active_class_entry)->name_length; + } + break; } + zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC); *result = *constant_container; result->u.constant.type = IS_CONSTANT | fetch_type; |
Copyright © 2001-2024 The PHP Group All rights reserved. |
Last updated: Thu Nov 21 17:01:32 2024 UTC |