cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug35393.phpt
| From: | Dmitry Stogov | Date: | Mon, 28 Nov 2005 14:33:24 +0000 |
| Subject: | cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug35393.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4400@lists.php.net to get a copy of this message | ||
dmitry Mon Nov 28 09:33:24 2005 EDT
Modified files:
/ZendEngine2 zend_vm_def.h zend_vm_execute.h
/ZendEngine2/tests bug35393.phpt
Log:
Fixed bug #35393 (changing static protected members from outside the class, one more reference
issue)
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.87&r2=1.88&ty=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.87 ZendEngine2/zend_vm_def.h:1.88
--- ZendEngine2/zend_vm_def.h:1.87 Thu Nov 17 03:27:25 2005
+++ ZendEngine2/zend_vm_def.h Mon Nov 28 09:33:22 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.87 2005/11/17 08:27:25 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.88 2005/11/28 14:33:22 dmitry Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -2219,7 +2219,8 @@
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
EX_T(opline->op1.u.var).var.fcall_returned_reference) &&
varptr != &EG(uninitialized_zval) &&
- (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
+ (PZVAL_IS_REF(varptr) ||
+ (varptr->refcount == 1 && (OP1_TYPE == IS_CV || free_op1.var)))) {
varptr->is_ref = 1;
varptr->refcount++;
zend_ptr_stack_push(&EG(argument_stack), varptr);
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.90&r2=1.91&ty=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.90 ZendEngine2/zend_vm_execute.h:1.91
--- ZendEngine2/zend_vm_execute.h:1.90 Thu Nov 17 03:27:25 2005
+++ ZendEngine2/zend_vm_execute.h Mon Nov 28 09:33:22 2005
@@ -7201,7 +7201,8 @@
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
EX_T(opline->op1.u.var).var.fcall_returned_reference) &&
varptr != &EG(uninitialized_zval) &&
- (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
+ (PZVAL_IS_REF(varptr) ||
+ (varptr->refcount == 1 && (IS_VAR == IS_CV || free_op1.var)))) {
varptr->is_ref = 1;
varptr->refcount++;
zend_ptr_stack_push(&EG(argument_stack), varptr);
@@ -19878,7 +19879,7 @@
static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
-
+ zend_free_op free_op1;
zval *varptr;
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at
compile_time */
@@ -19893,7 +19894,8 @@
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
EX_T(opline->op1.u.var).var.fcall_returned_reference) &&
varptr != &EG(uninitialized_zval) &&
- (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
+ (PZVAL_IS_REF(varptr) ||
+ (varptr->refcount == 1 && (IS_CV == IS_CV || free_op1.var)))) {
varptr->is_ref = 1;
varptr->refcount++;
zend_ptr_stack_push(&EG(argument_stack), varptr);
http://cvs.php.net/diff.php/ZendEngine2/tests/bug35393.phpt?r1=1.1&r2=1.2&ty=u
Index: ZendEngine2/tests/bug35393.phpt
diff -u /dev/null ZendEngine2/tests/bug35393.phpt:1.2
--- /dev/null Mon Nov 28 09:33:23 2005
+++ ZendEngine2/tests/bug35393.phpt Mon Nov 28 09:33:23 2005
@@ -0,0 +1,30 @@
+--TEST--
+Bug #35393 (changing static protected members from outside the class)
+--INI--
+error_reporting=4095
+--FILE--
+<?php
+class ObjectPath
+{
+ static protected $type = array(0=>'main');
+
+ static function getType()
+ {
+ return self::$type;
+ }
+}
+print_r(ObjectPath::getType());
+$object_type = array_pop((ObjectPath::getType()));
+print_r(ObjectPath::getType());
+?>
+--EXPECTF--
+Array
+(
+ [0] => main
+)
+
+Strict Standards: Only variables should be passed by reference in %sbug35393.php on line 12
+Array
+(
+ [0] => main
+)