- Fixed bug in xml_error_string() which resulted in messages being
off by one. (Scott)
+- Fixed bug #47165 (Possible memory corruption when passing return value by
+ reference). (Dmitry)
- Fixed bug #47152 (gzseek/fseek using SEEK_END produces strange results).
(Felipe)
- Fixed bug #47131 (SOAP Extension ignores "user_agent" ini setting). (Ilia)
--- /dev/null
+--TEST--
+Bug #47165 (Possible memory corruption when passing return value by reference)
+--FILE--
+<?php
+class Foo {
+ var $bar = array();
+
+ static function bar() {
+ static $instance = null;
+ $instance = new Foo();
+ return $instance->bar;
+ }
+}
+extract(Foo::bar());
+echo "ok\n";
+?>
+--EXPECT--
+ok
if (function_ptr) {
if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) {
- op = (param->op_type & (IS_VAR|IS_CV))?ZEND_SEND_REF:ZEND_SEND_VAL;
- send_by_reference = 0;
+ if (param->op_type & (IS_VAR|IS_CV)) {
+ send_by_reference = 1;
+ if (op == ZEND_SEND_VAR && zend_is_function_or_method_call(param)) {
+ /* Method call */
+ op = ZEND_SEND_VAR_NO_REF;
+ send_function = ZEND_ARG_SEND_FUNCTION | ZEND_ARG_SEND_SILENT;
+ }
+ } else {
+ op = ZEND_SEND_VAL;
+ send_by_reference = 0;
+ }
} else {
send_by_reference = ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset) ? ZEND_ARG_SEND_BY_REF : 0;
}
#define ZEND_ARG_SEND_BY_REF (1<<0)
#define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
#define ZEND_ARG_SEND_FUNCTION (1<<2)
+#define ZEND_ARG_SEND_SILENT (1<<3)
#define ZEND_SEND_BY_VAL 0
#define ZEND_SEND_BY_REF 1
} else {
zval *valptr;
- zend_error(E_STRICT, "Only variables should be passed by reference");
+ if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) {
+ zend_error(E_STRICT, "Only variables should be passed by reference");
+ }
ALLOC_ZVAL(valptr);
INIT_PZVAL_COPY(valptr, varptr);
if (!IS_OP1_TMP_FREE()) {
} else {
zval *valptr;
- zend_error(E_STRICT, "Only variables should be passed by reference");
+ if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) {
+ zend_error(E_STRICT, "Only variables should be passed by reference");
+ }
ALLOC_ZVAL(valptr);
INIT_PZVAL_COPY(valptr, varptr);
if (!0) {
} else {
zval *valptr;
- zend_error(E_STRICT, "Only variables should be passed by reference");
+ if (!(opline->extended_value & ZEND_ARG_SEND_SILENT)) {
+ zend_error(E_STRICT, "Only variables should be passed by reference");
+ }
ALLOC_ZVAL(valptr);
INIT_PZVAL_COPY(valptr, varptr);
if (!0) {