cvs: ZendEngine2 / zend_execute_API.c

[email protected] ("Dmitry Stogov")
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1219739895@cvsserver>
dmitry		Tue Aug 26 08:38:15 2008 UTC

  Modified files:              
    /ZendEngine2	zend_execute_API.c 
  Log:
  Fixed bug #45910 (Cannot declare self-referencing constant)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.461&r2=1.462&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.461 ZendEngine2/zend_execute_API.c:1.462
--- ZendEngine2/zend_execute_API.c:1.461	Thu Aug 14 10:06:39 2008
+++ ZendEngine2/zend_execute_API.c	Tue Aug 26 08:38:15 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.461 2008/08/14 10:06:39 helly Exp $ */
+/* $Id: zend_execute_API.c,v 1.462 2008/08/26 08:38:15 dmitry Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -583,6 +583,7 @@
 		zstr str_index;
 		uint str_index_len;
 		ulong num_index;
+		int ret;
 
 		SEPARATE_ZVAL_IF_NOT_REF(pp);
 		p = *pp;
@@ -656,20 +657,25 @@
 			switch (Z_TYPE(const_value)) {
 				case IS_STRING:
 				case IS_UNICODE:
-					zend_u_symtable_update_current_key(Z_ARRVAL_P(p), Z_TYPE(const_value), Z_UNIVAL(const_value), Z_UNILEN(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE);
+					ret = zend_u_symtable_update_current_key(Z_ARRVAL_P(p), Z_TYPE(const_value), Z_UNIVAL(const_value), Z_UNILEN(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE);
 					break;
 				case IS_BOOL:
 				case IS_LONG:
-					zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL_ZSTR, 0, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
+					ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL_ZSTR, 0, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
 					break;
 				case IS_DOUBLE:
-					zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL_ZSTR, 0, (long)Z_DVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
+					ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL_ZSTR, 0, (long)Z_DVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
 					break;
 				case IS_NULL:
-					zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, EMPTY_ZSTR, 1, 0, HASH_UPDATE_KEY_IF_BEFORE, NULL);
+					ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, EMPTY_ZSTR, 1, 0, HASH_UPDATE_KEY_IF_BEFORE, NULL);
 					break;
+				default:
+					ret = SUCCESS;
+					break;
+			}
+			if (ret == SUCCESS) {
+				zend_hash_move_forward(Z_ARRVAL_P(p));
 			}
-			zend_hash_move_forward(Z_ARRVAL_P(p));
 			zval_dtor(&const_value);
 		}
 		zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.