mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00

If op1 is ERROR the behavior is to not perform any assignment and return NULL. However, if the RHS was a by-value returning function, we'd instead emit a notice and return the RHS as the return value (even though the value was not assigned to anything -- the temporary is immediately destroyed). This normalized the behavior to always check for an ERROR in op1 first.
25 lines
470 B
PHP
25 lines
470 B
PHP
--TEST--
|
|
If the LHS of ref-assign ERRORs, that takes precendence over the "only variables" notice
|
|
--FILE--
|
|
<?php
|
|
|
|
function val() {
|
|
return 42;
|
|
}
|
|
|
|
$str = "foo";
|
|
$var = 24;
|
|
var_dump($str->foo =& $var);
|
|
var_dump($str);
|
|
var_dump($str->foo =& val());
|
|
var_dump($str);
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: Attempt to modify property 'foo' of non-object in %s on line %d
|
|
NULL
|
|
string(3) "foo"
|
|
|
|
Warning: Attempt to modify property 'foo' of non-object in %s on line %d
|
|
NULL
|
|
string(3) "foo"
|