diff options
author | Dmitry Stogov <dmitry@php.net> | 2005-06-08 13:21:28 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2005-06-08 13:21:28 +0000 |
commit | 9affa322374df36c3fbd2862563fb4673ebfc476 (patch) | |
tree | b825724d55ff9b20b961495f2c35259c1c9a439c | |
parent | a95db2790df798b89fcbd0a34f57e5c010c98c87 (diff) | |
download | php-git-9affa322374df36c3fbd2862563fb4673ebfc476.tar.gz |
Fixed bug #30140 (Problem with array in static properties)
-rwxr-xr-x | Zend/tests/bug30140.phpt | 30 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 8 |
2 files changed, 35 insertions, 3 deletions
diff --git a/Zend/tests/bug30140.phpt b/Zend/tests/bug30140.phpt new file mode 100755 index 0000000000..1dfb83500f --- /dev/null +++ b/Zend/tests/bug30140.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #30140 (Problem with array in static properties) +--FILE-- +<?php +class A { + public static $test1 = true; + public static $test2 = array(); + public static $test3 = "str"; +} + +class B extends A { +} + +A::$test1 = "x"; +A::$test2 = "y"; +A::$test3 = "z"; +var_dump(A::$test1); +var_dump(A::$test2); +var_dump(A::$test3); +var_dump(B::$test1); +var_dump(B::$test2); +var_dump(B::$test3); +?> +--EXPECT-- +string(1) "x" +string(1) "y" +string(1) "z" +string(1) "x" +string(1) "y" +string(1) "z" diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 0bfb3ff18a..b37b0f6119 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -426,11 +426,13 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) if (p->type == IS_CONSTANT) { int refcount; + zend_uchar is_ref; - SEPARATE_ZVAL(pp); + SEPARATE_ZVAL_IF_NOT_REF(pp); p = *pp; refcount = p->refcount; + is_ref = p->is_ref; if (!zend_get_constant(p->value.str.val, p->value.str.len, &const_value TSRMLS_CC)) { zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", @@ -447,15 +449,15 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC) *p = const_value; } - INIT_PZVAL(p); p->refcount = refcount; + p->is_ref = is_ref; } else if (p->type == IS_CONSTANT_ARRAY) { zval **element, *new_val; char *str_index; uint str_index_len; ulong num_index; - SEPARATE_ZVAL(pp); + SEPARATE_ZVAL_IF_NOT_REF(pp); p = *pp; p->type = IS_ARRAY; |