From 9e8a9e8bf12ce96ebadbbd753f01e7ad7fdf2b5a Mon Sep 17 00:00:00 2001 From: Brian Shire Date: Wed, 22 Apr 2009 21:27:19 +0000 Subject: [PATCH] MFH: fix DVAL_TO_LVAL conversion for static array indexes, related to bug #46701 --- Zend/zend_compile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index bee07b77a4..dfe8595b90 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3997,6 +3997,7 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode 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 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode 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"); -- 2.40.0