mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed bug #72813 (Segfault with __get returned by ref) Fix URL rewriter partially Conflicts: Zend/zend_object_handlers.c ext/standard/url_scanner_ex.c ext/standard/url_scanner_ex.re
This commit is contained in:
commit
dd618664a0
3 changed files with 46 additions and 13 deletions
43
Zend/tests/bug72813.phpt
Normal file
43
Zend/tests/bug72813.phpt
Normal file
|
@ -0,0 +1,43 @@
|
|||
--TEST--
|
||||
Bug #72813 (Segfault with __get returned by ref)
|
||||
--FILE--
|
||||
<?php
|
||||
class Test
|
||||
{
|
||||
private $props = ['a' => 'text', 'b' => 1];
|
||||
|
||||
public function &__get($prop)
|
||||
{
|
||||
return $this->props[$prop];
|
||||
}
|
||||
|
||||
public function __set($prop, $value)
|
||||
{
|
||||
if ($prop === 'b') $value = [$value];
|
||||
$this->props[$prop] = $value;
|
||||
}
|
||||
|
||||
public function getProperties()
|
||||
{
|
||||
return [$this->props];
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new Test;
|
||||
$obj->b = $obj->b;
|
||||
print_r($obj->getProperties());
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[a] => text
|
||||
[b] => Array
|
||||
(
|
||||
[0] => 1
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
|
@ -200,12 +200,8 @@ static void zend_std_call_getter(zval *object, zval *member, zval *retval) /* {{
|
|||
|
||||
it should return whether the call was successful or not
|
||||
*/
|
||||
if (Z_REFCOUNTED_P(member)) Z_ADDREF_P(member);
|
||||
|
||||
zend_call_method_with_1_params(object, ce, &ce->__get, ZEND_GET_FUNC_NAME, retval, member);
|
||||
|
||||
zval_ptr_dtor(member);
|
||||
|
||||
EG(fake_scope) = orig_fake_scope;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -219,9 +215,6 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value) /* {{{
|
|||
|
||||
EG(fake_scope) = NULL;
|
||||
|
||||
if (Z_REFCOUNTED_P(member)) Z_ADDREF_P(member);
|
||||
if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
|
||||
|
||||
/* __set handler is called with two arguments:
|
||||
property name
|
||||
value to be set
|
||||
|
@ -230,9 +223,6 @@ static int zend_std_call_setter(zval *object, zval *member, zval *value) /* {{{
|
|||
*/
|
||||
zend_call_method_with_2_params(object, ce, &ce->__set, ZEND_SET_FUNC_NAME, &retval, member, value);
|
||||
|
||||
zval_ptr_dtor(member);
|
||||
zval_ptr_dtor(value);
|
||||
|
||||
if (Z_TYPE(retval) != IS_UNDEF) {
|
||||
result = i_zend_is_true(&retval) ? SUCCESS : FAILURE;
|
||||
zval_ptr_dtor(&retval);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Generated by re2c 0.14.3 */
|
||||
/* Generated by re2c 0.13.5 */
|
||||
#line 1 "ext/standard/url_scanner_ex.re"
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
|
@ -1018,7 +1018,7 @@ yy60:
|
|||
if (yybm[0+yych] & 64) {
|
||||
goto yy59;
|
||||
}
|
||||
if (yych <= '\'') goto yy62;
|
||||
if (yych <= '=') goto yy62;
|
||||
yy61:
|
||||
YYCURSOR = YYMARKER;
|
||||
goto yy52;
|
||||
|
@ -1035,7 +1035,7 @@ yy65:
|
|||
if (yybm[0+yych] & 128) {
|
||||
goto yy64;
|
||||
}
|
||||
if (yych >= '#') goto yy61;
|
||||
if (yych >= '>') goto yy61;
|
||||
++YYCURSOR;
|
||||
#line 559 "ext/standard/url_scanner_ex.re"
|
||||
{ handle_val(STD_ARGS, 1, '"'); goto state_next_arg_begin; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue