cvs: ZendEngine2 / zend_execute.c /tests bug36303.phpt bug44660.phpt

"Dmitry Stogov" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1217095218@cvsserver>
dmitry		Sat Jul 26 18:00:18 2008 UTC

  Modified files:              
    /ZendEngine2	zend_execute.c 
    /ZendEngine2/tests	bug44660.phpt bug36303.phpt 
  Log:
  Fixed bug #44660 (Indexed and reference assignment to propery of non-object don't trigger warning)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.801&r2=1.802&diff_format=u
Index: ZendEngine2/zend_execute.c
diff -u ZendEngine2/zend_execute.c:1.801 ZendEngine2/zend_execute.c:1.802
--- ZendEngine2/zend_execute.c:1.801	Sat Jul 26 14:09:05 2008
+++ ZendEngine2/zend_execute.c	Sat Jul 26 18:00:17 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute.c,v 1.801 2008/07/26 14:09:05 dmitry Exp $ */
+/* $Id: zend_execute.c,v 1.802 2008/07/26 18:00:17 dmitry Exp $ */
 
 #define ZEND_INTENSIVE_DEBUGGING 0
 
@@ -1289,6 +1289,7 @@
 			zend_error(E_STRICT, "Creating default object from empty value");
 			object_init(container);
 		} else {
+			zend_error(E_WARNING, "Attempt to modify property of non-object");
 			result->var.ptr_ptr = &EG(error_zval_ptr);
 			PZVAL_LOCK(EG(error_zval_ptr));
  			return;
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug44660.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug44660.phpt
diff -u /dev/null ZendEngine2/tests/bug44660.phpt:1.2
--- /dev/null	Sat Jul 26 18:00:18 2008
+++ ZendEngine2/tests/bug44660.phpt	Sat Jul 26 18:00:18 2008
@@ -0,0 +1,49 @@
+--TEST--
+Bug #44660 (Indexed and reference assignment to propery of non-object don't trigger warning)
+--FILE--
+<?php
+$s = "hello";
+$a = true;
+
+echo "--> read access: ";
+echo $a->p;
+
+echo "\n--> direct assignment: ";
+$a->p = $s;
+
+echo "\n--> increment: ";
+$a->p++;
+
+echo "\n--> reference assignment:";
+$a->p =& $s;
+
+echo "\n--> reference assignment:";
+$s =& $a->p;
+
+echo "\n--> indexed assignment:";
+$a->p[0] = $s;
+
+echo "\n--> Confirm assignments have had no impact:\n";
+var_dump($a);
+?>
+--EXPECTF--
+--> read access: 
+Notice: Trying to get property of non-object in %sbug44660.php on line 6
+
+--> direct assignment: 
+Warning: Attempt to assign property of non-object in %sbug44660.php on line 9
+
+--> increment: 
+Warning: Attempt to increment/decrement property of non-object in %sbug44660.php on line 12
+
+--> reference assignment:
+Warning: Attempt to modify property of non-object in %sbug44660.php on line 15
+
+--> reference assignment:
+Warning: Attempt to modify property of non-object in %sbug44660.php on line 18
+
+--> indexed assignment:
+Warning: Attempt to modify property of non-object in %sbug44660.php on line 21
+
+--> Confirm assignments have had no impact:
+bool(true)
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug36303.phpt?r1=1.3&r2=1.4&diff_format=u
Index: ZendEngine2/tests/bug36303.phpt
diff -u ZendEngine2/tests/bug36303.phpt:1.3 ZendEngine2/tests/bug36303.phpt:1.4
--- ZendEngine2/tests/bug36303.phpt:1.3	Sat May 24 15:13:08 2008
+++ ZendEngine2/tests/bug36303.phpt	Sat Jul 26 18:00:18 2008
@@ -8,5 +8,7 @@
 echo "ok\n";
 ?>
 --EXPECTF--
+Warning: Attempt to modify property of non-object in %sbug36303.php on line 3
+
 Warning: Invalid argument supplied for foreach() in %sbug36303.php on line 3
 ok



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.