]> granicus.if.org Git - php/commitdiff
fix DVAL_TO_LVAL conversion for static array indexes, related to bug #46701
authorBrian Shire <shire@php.net>
Wed, 22 Apr 2009 21:27:17 +0000 (21:27 +0000)
committerBrian Shire <shire@php.net>
Wed, 22 Apr 2009 21:27:17 +0000 (21:27 +0000)
Zend/zend_compile.c

index 3fbc529a1a823f6e0579b96a660f497a1293ac83..e55c8b5ebea82eb8a869c47c4d8fa11b8430b160 100644 (file)
@@ -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");