From: Brian Shire Date: Wed, 22 Apr 2009 21:27:17 +0000 (+0000) Subject: fix DVAL_TO_LVAL conversion for static array indexes, related to bug #46701 X-Git-Tag: php-5.4.0alpha1~191^2~3882 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82cabe1ca41b44241214bfda2294068f7e7d52f3;p=php fix DVAL_TO_LVAL conversion for static array indexes, related to bug #46701 --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 3fbc529a1a..e55c8b5ebe 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4195,6 +4195,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; zend_uchar utype = Z_TYPE(offset->u.constant); switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) { @@ -4222,7 +4223,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");