cvs: ZendEngine2(PHP_5_3) / zend.h zend_compile.c zend_execute_API.c

From: Date: Fri, 02 Nov 2007 10:11:43 +0000
Subject: cvs: ZendEngine2(PHP_5_3) / zend.h zend_compile.c zend_execute_API.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6120@lists.php.net to get a copy of this message
dmitry Fri Nov 2 10:11:43 2007 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2 zend.h zend_compile.c zend_execute_API.c Log: Reimplemented support for namespaces in indexes id constant arrays (removed zval.idx_type) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.h?r1=1.293.2.11.2.9.2.7&r2=1.293.2.11.2.9.2.8&diff_format=u Index: ZendEngine2/zend.h diff -u ZendEngine2/zend.h:1.293.2.11.2.9.2.7 ZendEngine2/zend.h:1.293.2.11.2.9.2.8 --- ZendEngine2/zend.h:1.293.2.11.2.9.2.7 Sun Oct 7 05:22:02 2007 +++ ZendEngine2/zend.h Fri Nov 2 10:11:42 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend.h,v 1.293.2.11.2.9.2.7 2007/10/07 05:22:02 davidw Exp $ */ +/* $Id: zend.h,v 1.293.2.11.2.9.2.8 2007/11/02 10:11:42 dmitry Exp $ */ #ifndef ZEND_H #define ZEND_H @@ -298,7 +298,6 @@ zend_uint refcount__gc; zend_uchar type; /* active type */ zend_uchar is_ref__gc; - zend_uchar idx_type; /* type of element's index in constant array */ }; #define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz)) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.13&r2=1.647.2.27.2.41.2.14&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.13 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.14 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.13 Thu Nov 1 11:58:58 2007 +++ ZendEngine2/zend_compile.c Fri Nov 2 10:11:42 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.13 2007/11/01 11:58:58 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.14 2007/11/02 10:11:42 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -3643,8 +3643,12 @@ case IS_CONSTANT: /* Ugly hack to denote that this value has a constant index */ Z_TYPE_P(element) |= IS_CONSTANT_INDEX; - element->idx_type = Z_TYPE(offset->u.constant); - /* break missing intentionally */ + Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3); + Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+1] = Z_TYPE(offset->u.constant); + Z_STRVAL(offset->u.constant)[Z_STRLEN(offset->u.constant)+2] = 0; + zend_symtable_update(result->u.constant.value.ht, Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3, &element, sizeof(zval *), NULL); + zval_dtor(&offset->u.constant); + break; case IS_STRING: zend_symtable_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL); zval_dtor(&offset->u.constant); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.8&r2=1.331.2.20.2.24.2.9&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.8 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.9 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.8 Sun Oct 7 05:22:03 2007 +++ ZendEngine2/zend_execute_API.c Fri Nov 2 10:11:42 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.8 2007/10/07 05:22:03 davidw Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.9 2007/11/02 10:11:42 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -517,34 +517,27 @@ zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } - if (!zend_get_constant_ex(str_index, str_index_len-1, &const_value, scope, (*element)->idx_type TSRMLS_CC)) { - if ((colon = memchr(str_index, ':', str_index_len-1)) && colon[1] == ':') { + if (!zend_get_constant_ex(str_index, str_index_len-3, &const_value, scope, str_index[str_index_len-2] TSRMLS_CC)) { + if ((colon = memchr(str_index, ':', str_index_len-3)) && colon[1] == ':') { zend_error(E_ERROR, "Undefined class constant '%s'", str_index); } zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str_index, str_index); - zend_hash_move_forward(Z_ARRVAL_P(p)); - continue; + ZVAL_STRINGL(&const_value, str_index, str_index_len-3, 1); } - if (const_value.type == IS_STRING && const_value.value.str.len == (int)str_index_len-1 && - !strncmp(const_value.value.str.val, str_index, str_index_len)) { - /* constant value is the same as its name */ - zval_dtor(&const_value); - zend_hash_move_forward(p->value.ht); - continue; + if (Z_REFCOUNT_PP(element) > 1) { + ALLOC_ZVAL(new_val); + *new_val = **element; + zval_copy_ctor(new_val); + Z_SET_REFCOUNT_P(new_val, 1); + Z_UNSET_ISREF_P(new_val); + + /* preserve this bit for inheritance */ + Z_TYPE_PP(element) |= IS_CONSTANT_INDEX; + zval_ptr_dtor(element); + *element = new_val; } - ALLOC_ZVAL(new_val); - *new_val = **element; - zval_copy_ctor(new_val); - Z_SET_REFCOUNT_P(new_val, 1); - Z_UNSET_ISREF_P(new_val); - - /* preserve this bit for inheritance */ - Z_TYPE_PP(element) |= IS_CONSTANT_INDEX; - zval_ptr_dtor(element); - *element = new_val; - switch (Z_TYPE(const_value)) { case IS_STRING: zend_symtable_update_current_key(Z_ARRVAL_P(p), const_value.value.str.val, const_value.value.str.len+1);

« previous php.zend-engine.cvs (#6120) next »