- Fixed bug #31705 (parse_url() does not recognize http://foo.com#bar). (Ilia)
- Fixed bug #31684 (dio_tcsetattr(): misconfigured termios settings).
(elod at itfais dot com)
+- Fixed bug #31683 (changes to $name in __get($name) override future
+ parameters). (Dmitry)
- Fixed bug #31699 (unserialize() float problem on non-English locales). (Ilia)
- Fixed bug #31651 (ReflectionClass::getDefaultProperties segfaults with arrays).
(Marcus)
in segfault). (pdan-php at esync dot org, Tony)
- Fixed bug #30120 (imagettftext() and imagettfbbox() accept too many
parameters). (Jani)
+- Fixed bug #29767 (Weird behaviour of __set($name, $value)). (Dmitry)
- Fixed bug #29733 (printf() handles repeated placeholders wrong).
(bugs dot php dot net at bluetwanger dot de, Ilia)
- Fixed bug #29136 (make test - libtool failure on MacOSX). (Jani)
--- /dev/null
+--TEST--
+Bug #31683 (changes to $name in __get($name) override future parameters)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class Foo implements ArrayAccess {
+
+ function __get($test) {
+ var_dump($test);
+ $test = 'bug';
+ }
+
+ function __set($test, $val) {
+ var_dump($test);
+ var_dump($val);
+ $test = 'bug';
+ $val = 'bug';
+ }
+
+ function __call($test, $arg) {
+ var_dump($test);
+ $test = 'bug';
+ }
+
+ function offsetget($test) {
+ var_dump($test);
+ $test = 'bug';
+ return 123;
+ }
+
+ function offsetset($test, $val) {
+ var_dump($test);
+ var_dump($val);
+ $test = 'bug';
+ $val = 'bug';
+ }
+
+ function offsetexists($test) {
+ var_dump($test);
+ $test = 'bug';
+ }
+
+ function offsetunset($test) {
+ var_dump($test);
+ $test = 'bug';
+ }
+
+}
+
+$foo = new Foo();
+$a = "ok";
+
+for ($i=0; $i < 2; $i++) {
+ $foo->ok("ok");
+ $foo->ok;
+ $foo->ok = "ok";
+ $x = $foo["ok"];
+ $foo["ok"] = "ok";
+ isset($foo["ok"]);
+ unset($foo["ok"]);
+// $foo[];
+ $foo[] = "ok";
+// isset($foo[]);
+// unset($foo[]);
+ $foo->$a;
+ echo "---\n";
+}
+?>
+--EXPECT--
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+NULL
+string(2) "ok"
+string(2) "ok"
+---
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+string(2) "ok"
+NULL
+string(2) "ok"
+string(2) "ok"
+---
INIT_PZVAL(&__get_name);
ZVAL_STRINGL(&__get_name, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1, 0);
+ SEPARATE_ARG_IF_REF(member);
call_args[0] = &member;
/* go call the __get handler */
retval returns the value that is received
*/
-
if (call_result == FAILURE) {
zend_error(E_ERROR, "Could not call __get handler for class %s", Z_OBJCE_P(object)->name);
return NULL;
}
+
+ zval_ptr_dtor(&member);
+
if (retval) {
retval->refcount--;
}
INIT_PZVAL(&__set_name);
ZVAL_STRINGL(&__set_name, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1, 0);
+ SEPARATE_ARG_IF_REF(member);
call_args[0] = &member;
value->refcount++;
call_args[1] = &value;
return FAILURE;
}
+ zval_ptr_dtor(&member);
zval_ptr_dtor(&value);
if (retval && zend_is_true(retval)) {
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
if(offset == NULL) {
/* [] construct */
- zval offset_null;
- INIT_ZVAL(offset_null);
- offset = &offset_null;
+ ALLOC_INIT_ZVAL(offset);
+ } else {
+ SEPARATE_ARG_IF_REF(offset);
}
zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset);
+ zval_ptr_dtor(&offset);
+
if (!retval) {
if (!EG(exception)) {
zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name);
static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC)
{
zend_class_entry *ce = Z_OBJCE_P(object);
- zval tmp;
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
if (!offset) {
- INIT_ZVAL(tmp);
- offset = &tmp;
+ ALLOC_INIT_ZVAL(offset);
+ } else {
+ SEPARATE_ARG_IF_REF(offset);
}
zend_call_method_with_2_params(&object, ce, NULL, "offsetset", NULL, offset, value);
+ zval_ptr_dtor(&offset);
} else {
zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name);
}
int result;
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
+ SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset);
+ zval_ptr_dtor(&offset);
result = i_zend_is_true(retval);
zval_ptr_dtor(&retval);
return result;
zval *retval;
if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
+ SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", &retval, offset);
+ zval_ptr_dtor(&offset);
zval_ptr_dtor(&retval);
} else {
zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name);