diff options
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | Zend/tests/bug35393.phpt | 30 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 3 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 8 | ||||
-rw-r--r-- | ext/standard/tests/file/proc_open01.phpt | 4 |
5 files changed, 42 insertions, 5 deletions
@@ -5,6 +5,8 @@ PHP NEWS - Fixed bug #35430 (PDO crashes on incorrect FETCH_FUNC use). (Tony) - Fixed bug #35399 (Since fix of bug #35273 SOAP decoding of soapenc:base64binary fails). (Dmitry) +- Fixed bug #35393 (changing static protected members from outside the class, + one more reference issue). (Dmitry) - Fixed bug #35381 (ssl library is not initialized properly). (Alan) 28 Nov 2005, PHP 5.1.1 diff --git a/Zend/tests/bug35393.phpt b/Zend/tests/bug35393.phpt new file mode 100755 index 0000000000..ce3bdd001a --- /dev/null +++ b/Zend/tests/bug35393.phpt @@ -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 +) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 08983deeb8..7a0e2f5271 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2186,7 +2186,8 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) 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); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index d3affc42dd..79faacb0d6 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -7057,7 +7057,8 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) 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); @@ -19139,7 +19140,7 @@ static int zend_send_by_var_helper_SPEC_CV(ZEND_OPCODE_HANDLER_ARGS) 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 */ @@ -19154,7 +19155,8 @@ static int ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) 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); diff --git a/ext/standard/tests/file/proc_open01.phpt b/ext/standard/tests/file/proc_open01.phpt index 39fc4e4cf6..c5b0ed971b 100644 --- a/ext/standard/tests/file/proc_open01.phpt +++ b/ext/standard/tests/file/proc_open01.phpt @@ -30,7 +30,9 @@ for ($left = strlen($test_string); $left > 0;) { break; } $read_fds = array($pipes[1]); - $retval = stream_select($read_fds, $write_fds = NULL, $exp_fds = NULL, 1); + $write_fds = NULL; + $exp_fds = NULL; + $retval = stream_select($read_fds, $write_fds, $exp_fds, 1); if ($retval === false) { print "select() failed\n"; break; |