cvs: ZendEngine2(PHP_5_3) / zend_compile.c

[email protected] ("Brian Shire") Wed, 22 Apr 2009 21:27:19 -0000
Newsgroups php.zend-engine.cvs
Message-ID <cvsshire1240435639@cvsserver>
shire		Wed Apr 22 21:27:19 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /ZendEngine2	zend_compile.c 
  Log:
  MFH: fix DVAL_TO_LVAL conversion for static array indexes, related to bug #46701
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.106&r2=1.647.2.27.2.41.2.107&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.106 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.107
--- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.106	Thu Apr 16 13:48:01 2009
+++ ZendEngine2/zend_compile.c	Wed Apr 22 21:27:19 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.106 2009/04/16 13:48:01 bjori Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.107 2009/04/22 21:27:19 shire Exp $ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -3997,6 +3997,7 @@
 	ALLOC_ZVAL(element);
 	*element = expr->u.constant;
 	if (offset) {
+		long l;
 		switch (offset->u.constant.type & IS_CONSTANT_TYPE_MASK) {
 			case IS_CONSTANT:
 				/* Ugly hack to denote that this value has a constant index */
@@ -4019,7 +4020,8 @@
 				zend_hash_index_update(Z_ARRVAL(result->u.constant), Z_LVAL(offset->u.constant), &element, sizeof(zval *), NULL);
 				break;
 			case IS_DOUBLE:
-				zend_hash_index_update(Z_ARRVAL(result->u.constant), (long)Z_DVAL(offset->u.constant), &element, sizeof(zval *), NULL);
+				DVAL_TO_LVAL(Z_DVAL(offset->u.constant), l);
+				zend_hash_index_update(Z_ARRVAL(result->u.constant), l, &element, sizeof(zval *), NULL);
 				break;
 			case IS_CONSTANT_ARRAY:
 				zend_error(E_ERROR, "Illegal offset type");