cvs: ZendEngine2 / zend_execute.c
| From: | Stanislav Malyshev | Date: | Mon, 04 Aug 2003 09:10:52 +0000 |
| Subject: | cvs: ZendEngine2 / zend_execute.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1599@lists.php.net to get a copy of this message | ||
stas Mon Aug 4 05:10:52 2003 EDT
Modified files:
/ZendEngine2 zend_execute.c
Log:
Fix #24884 - clone $this
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.516 ZendEngine2/zend_execute.c:1.517
--- ZendEngine2/zend_execute.c:1.516 Sun Aug 3 13:40:44 2003
+++ ZendEngine2/zend_execute.c Mon Aug 4 05:10:52 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute.c,v 1.516 2003/08/03 17:40:44 zeev Exp $ */
+/* $Id: zend_execute.c,v 1.517 2003/08/04 09:10:52 stas Exp $ */
#define ZEND_INTENSIVE_DEBUGGING 0
@@ -3056,12 +3056,17 @@
int zend_clone_handler(ZEND_OPCODE_HANDLER_ARGS)
{
- zval *obj = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
+ zval *obj;
zend_class_entry *ce;
zend_function *clone;
zend_object_clone_obj_t clone_call;
-
- if (Z_TYPE_P(obj) != IS_OBJECT) {
+ if(EX(opline)->op1.op_type == IS_UNUSED) {
+ /* this */
+ obj = EG(This);
+ } else {
+ obj = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
+ }
+ if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
zend_error(E_WARNING, "__clone method called on non-object");
EX_T(EX(opline)->result.u.var).var.ptr = EG(error_zval_ptr);
EX_T(EX(opline)->result.u.var).var.ptr->refcount++;