]> granicus.if.org Git - php/commitdiff
Partial fix for bug #26584 (Class member - array key overflow)
authorDmitry Stogov <dmitry@php.net>
Fri, 24 Jun 2005 09:25:02 +0000 (09:25 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 24 Jun 2005 09:25:02 +0000 (09:25 +0000)
It doesn't fix integer overflow problem, but allows null, boolean and double keys in array constants in the same way as in runtime.

Zend/zend_compile.c

index 3e372a1bbc43b66ea83e6c1a12da1dd7bee26342..f0da66afadfa7ee0dcbf417e4cce27ab147e3a97 100644 (file)
@@ -3027,9 +3027,16 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr)
                                zend_symtable_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL);
                                zval_dtor(&offset->u.constant);
                                break;
+                       case IS_NULL:
+                               zend_symtable_update(result->u.constant.value.ht, "", 1, &element, sizeof(zval *), NULL);
+                               break;
                        case IS_LONG:
+                       case IS_BOOL: 
                                zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL);
                                break;
+                       case IS_DOUBLE:
+                               zend_hash_index_update(result->u.constant.value.ht, (long)offset->u.constant.value.dval, &element, sizeof(zval *), NULL);
+                               break;
                }
        } else {
                zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL);