cvs: ZendEngine2 / zend_execute_API.c /tests bug30140.phpt

From: Date: Wed, 08 Jun 2005 13:21:28 +0000
Subject: cvs: ZendEngine2 / zend_execute_API.c /tests bug30140.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-3760@lists.php.net to get a copy of this message
dmitry Wed Jun 8 09:21:28 2005 EDT Modified files: /ZendEngine2 zend_execute_API.c /ZendEngine2/tests bug30140.phpt Log: Fixed bug #30140 (Problem with array in static properties) http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.319&r2=1.320&ty=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.319 ZendEngine2/zend_execute_API.c:1.320 --- ZendEngine2/zend_execute_API.c:1.319 Thu May 26 10:28:23 2005 +++ ZendEngine2/zend_execute_API.c Wed Jun 8 09:21:28 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.319 2005/05/26 14:28:23 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.320 2005/06/08 13:21:28 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -426,11 +426,13 @@ 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 @@ *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; http://cvs.php.net/diff.php/ZendEngine2/tests/bug30140.phpt?r1=1.1&r2=1.2&ty=u Index: ZendEngine2/tests/bug30140.phpt diff -u /dev/null ZendEngine2/tests/bug30140.phpt:1.2 --- /dev/null Wed Jun 8 09:21:28 2005 +++ ZendEngine2/tests/bug30140.phpt Wed Jun 8 09:21:28 2005 @@ -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"

« previous php.zend-engine.cvs (#3760) next »