iliaa Thu Oct 4 23:25:53 2007 UTC
Modified files:
/ZendEngine2 zend_vm_def.h zend_vm_execute.h
/ZendEngine2/tests bug42817.phpt bug42818.phpt bug36071.phpt
Log:
MFB: Fixed bug #42817 (clone() on a non-object does not result in a fatal
error)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.190&r2=1.191&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.190 ZendEngine2/zend_vm_def.h:1.191
--- ZendEngine2/zend_vm_def.h:1.190 Wed Oct 3 09:47:59 2007
+++ ZendEngine2/zend_vm_def.h Thu Oct 4 23:25:53 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.190 2007/10/03 09:47:59 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.191 2007/10/04 23:25:53 iliaa Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -2657,10 +2657,10 @@
zend_object_clone_obj_t clone_call;
if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
- zend_error(E_WARNING, "__clone method called on non-object");
+ zend_error_noreturn(E_ERROR, "__clone method called on
non-object");
EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
EX_T(opline->result.u.var).var.ptr->refcount++;
- FREE_OP1();
+ FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE();
}
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.194&r2=1.195&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.194 ZendEngine2/zend_vm_execute.h:1.195
--- ZendEngine2/zend_vm_execute.h:1.194 Wed Oct 3 09:47:59 2007
+++ ZendEngine2/zend_vm_execute.h Thu Oct 4 23:25:53 2007
@@ -1647,7 +1647,7 @@
zend_object_clone_obj_t clone_call;
if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
- zend_error(E_WARNING, "__clone method called on non-object");
+ zend_error_noreturn(E_ERROR, "__clone method called on
non-object");
EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
EX_T(opline->result.u.var).var.ptr->refcount++;
@@ -4852,10 +4852,10 @@
zend_object_clone_obj_t clone_call;
if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
- zend_error(E_WARNING, "__clone method called on non-object");
+ zend_error_noreturn(E_ERROR, "__clone method called on
non-object");
EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
EX_T(opline->result.u.var).var.ptr->refcount++;
- zval_dtor(free_op1.var);
+
ZEND_VM_NEXT_OPCODE();
}
@@ -8145,7 +8145,7 @@
zend_object_clone_obj_t clone_call;
if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
- zend_error(E_WARNING, "__clone method called on non-object");
+ zend_error_noreturn(E_ERROR, "__clone method called on
non-object");
EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
EX_T(opline->result.u.var).var.ptr->refcount++;
if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};
@@ -16192,7 +16192,7 @@
zend_object_clone_obj_t clone_call;
if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
- zend_error(E_WARNING, "__clone method called on non-object");
+ zend_error_noreturn(E_ERROR, "__clone method called on
non-object");
EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
EX_T(opline->result.u.var).var.ptr->refcount++;
@@ -21362,7 +21362,7 @@
zend_object_clone_obj_t clone_call;
if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
- zend_error(E_WARNING, "__clone method called on non-object");
+ zend_error_noreturn(E_ERROR, "__clone method called on
non-object");
EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
EX_T(opline->result.u.var).var.ptr->refcount++;
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug42817.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug42817.phpt
diff -u /dev/null ZendEngine2/tests/bug42817.phpt:1.2
--- /dev/null Thu Oct 4 23:25:53 2007
+++ ZendEngine2/tests/bug42817.phpt Thu Oct 4 23:25:53 2007
@@ -0,0 +1,9 @@
+--TEST--
+Bug #42817 (clone() on a non-object does not result in a fatal error)
+--FILE--
+<?php
+$a = clone(null);
+array_push($a->b, $c);
+?>
+--EXPECTF--
+Fatal error: __clone method called on non-object in %sbug42817.php on line 2
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug42818.phpt?r1=1.2&r2=1.3&diff_format=u
Index: ZendEngine2/tests/bug42818.phpt
diff -u ZendEngine2/tests/bug42818.phpt:1.2 ZendEngine2/tests/bug42818.phpt:1.3
--- ZendEngine2/tests/bug42818.phpt:1.2 Wed Oct 3 09:47:59 2007
+++ ZendEngine2/tests/bug42818.phpt Thu Oct 4 23:25:53 2007
@@ -5,5 +5,5 @@
$foo = clone(array());
?>
--EXPECTF--
-Warning: __clone method called on non-object in %sbug42818.php on line 2
+Fatal error: __clone method called on non-object in %sbug42818.php on line 2
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug36071.phpt?r1=1.2&r2=1.3&diff_format=u
Index: ZendEngine2/tests/bug36071.phpt
diff -u ZendEngine2/tests/bug36071.phpt:1.2 ZendEngine2/tests/bug36071.phpt:1.3
--- ZendEngine2/tests/bug36071.phpt:1.2 Thu Jan 19 07:26:58 2006
+++ ZendEngine2/tests/bug36071.phpt Thu Oct 4 23:25:53 2007
@@ -6,8 +6,6 @@
<?php
$a = clone 0;
$a[0]->b = 0;
-echo "ok\n";
?>
--EXPECTF--
-Warning: __clone method called on non-object in %sbug36071.php on line 2
-ok
\ No newline at end of file
+Fatal error: __clone method called on non-object in %sbug36071.php on line 2
\ No newline at end of file
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|