mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Fix for bug #22367.
Heads up - this will break syntactical compatiblity, return($foo) will not work with functions that return references - return $foo should be used instead. It never worked well before, and caused all sorts of odd bugs. It *might* be possible to support this specifically, albeit unlikely
This commit is contained in:
parent
92e9e0ca7e
commit
d245c52e0c
@ -2748,6 +2748,11 @@ int zend_return_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
zend_error(E_ERROR, "Cannot return overloaded elements or string offsets by reference");
|
||||
}
|
||||
|
||||
if (!(*retval_ptr_ptr)->is_ref
|
||||
&& EX_T(EX(opline)->op1.u.var).var.ptr_ptr == &EX_T(EX(opline)->op1.u.var).var.ptr) {
|
||||
zend_error(E_ERROR, "Only variables or references can be returned by reference");
|
||||
}
|
||||
|
||||
SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr);
|
||||
(*retval_ptr_ptr)->refcount++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user