cvs: ZendEngine2 / zend_compile.c

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

  Modified files:              
    /ZendEngine2	zend_compile.c 
  Log:
  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.855&r2=1.856&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.855 ZendEngine2/zend_compile.c:1.856
--- ZendEngine2/zend_compile.c:1.855	Thu Apr 16 13:47:24 2009
+++ ZendEngine2/zend_compile.c	Wed Apr 22 21:27:17 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.855 2009/04/16 13:47:24 bjori Exp $ */
+/* $Id: zend_compile.c,v 1.856 2009/04/22 21:27:17 shire Exp $ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -4195,6 +4195,7 @@
 	ALLOC_ZVAL(element);
 	*element = expr->u.constant;
 	if (offset) {
+		long l;
 		zend_uchar utype = Z_TYPE(offset->u.constant);
 
 		switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) {
@@ -4222,7 +4223,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");