cvs: ZendEngine2 / zend_execute.c
| From: | Zeev Suraski | Date: | Wed, 02 Jul 2003 15:06:11 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1432@lists.php.net to get a copy of this message | ||
zeev Wed Jul 2 11:06:11 2003 EDT
Modified files:
/ZendEngine2 zend_execute.c
Log:
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
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.483 ZendEngine2/zend_execute.c:1.484
--- ZendEngine2/zend_execute.c:1.483 Tue Jul 1 17:30:21 2003
+++ ZendEngine2/zend_execute.c Wed Jul 2 11:06:10 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.483 2003/07/01 21:30:21 helly Exp $ */
+/* $Id: zend_execute.c,v 1.484 2003/07/02 15:06:10 zeev Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -2748,6 +2748,11 @@
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++;