cvs: ZendEngine2(PHP_5_2) / zend_execute_API.c zend_vm_def.h zend_vm_execute.h /tests bug41633_1.phpt bug41633_2.phpt

From: Date: Wed, 13 Jun 2007 14:50:14 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_execute_API.c zend_vm_def.h zend_vm_execute.h /tests bug41633_1.phpt bug41633_2.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5849@lists.php.net to get a copy of this message
dmitry Wed Jun 13 14:50:14 2007 UTC Added files: (Branch: PHP_5_2) /ZendEngine2/tests bug41633_1.phpt bug41633_2.phpt Modified files: /ZendEngine2 zend_execute_API.c zend_vm_def.h zend_vm_execute.h Log: Fixed some class constant issues related to bug #41633 http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.21&r2=1.331.2.20.2.22&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.21 ZendEngine2/zend_execute_API.c:1.331.2.20.2.22 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.21 Mon May 21 07:12:41 2007 +++ ZendEngine2/zend_execute_API.c Wed Jun 13 14:50:12 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.21 2007/05/21 07:12:41 tony2001 Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.22 2007/06/13 14:50:12 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -453,6 +453,7 @@ zval *p = *pp; zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg; zval const_value; + char *colon; if (Z_TYPE_P(p) == IS_CONSTANT) { int refcount; @@ -465,6 +466,9 @@ is_ref = p->is_ref; if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope TSRMLS_CC)) { + if ((colon = memchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p))) && colon[1] == ':') { + zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p)); + } zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", p->value.str.val, p->value.str.val); @@ -504,6 +508,9 @@ continue; } if (!zend_get_constant_ex(str_index, str_index_len-1, &const_value, scope TSRMLS_CC)) { + if ((colon = memchr(str_index, ':', str_index_len-1)) && 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; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.45&r2=1.59.2.29.2.46&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.45 ZendEngine2/zend_vm_def.h:1.59.2.29.2.46 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.45 Fri May 18 13:12:04 2007 +++ ZendEngine2/zend_vm_def.h Wed Jun 13 14:50:12 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.45 2007/05/18 13:12:04 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.46 2007/06/13 14:50:12 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -2613,7 +2613,11 @@ ce = EX_T(opline->op1.u.var).class_entry; if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { + zend_class_entry *old_scope = EG(scope); + + EG(scope) = ce; zval_update_constant(value, (void *) 1 TSRMLS_CC); + EG(scope) = old_scope; EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); } else { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.45&r2=1.62.2.30.2.46&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.45 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.46 --- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.45 Fri May 18 13:12:04 2007 +++ ZendEngine2/zend_vm_execute.h Wed Jun 13 14:50:13 2007 @@ -2694,7 +2694,11 @@ ce = EX_T(opline->op1.u.var).class_entry; if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { + zend_class_entry *old_scope = EG(scope); + + EG(scope) = ce; zval_update_constant(value, (void *) 1 TSRMLS_CC); + EG(scope) = old_scope; EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); } else { @@ -15486,7 +15490,11 @@ ce = EX_T(opline->op1.u.var).class_entry; if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) { + zend_class_entry *old_scope = EG(scope); + + EG(scope) = ce; zval_update_constant(value, (void *) 1 TSRMLS_CC); + EG(scope) = old_scope; EX_T(opline->result.u.var).tmp_var = **value; zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var); } else { http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug41633_1.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug41633_1.phpt +++ ZendEngine2/tests/bug41633_1.phpt http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug41633_2.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug41633_2.phpt +++ ZendEngine2/tests/bug41633_2.phpt

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