]> granicus.if.org Git - php/commitdiff
MFH: fix #38624 (Strange warning when incrementing an object property and exception...
authorAntony Dovgal <tony2001@php.net>
Mon, 28 Aug 2006 10:27:58 +0000 (10:27 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 28 Aug 2006 10:27:58 +0000 (10:27 +0000)
NEWS
Zend/tests/bug38624.phpt [new file with mode: 0644]
Zend/zend_interfaces.c

diff --git a/NEWS b/NEWS
index 89f467dbfae9df77a169a5d80f39ba0f13b56e76..58d706b281dec76685125c21532c3d61fdde4e3f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP                                                                        NEWS
   SoapServer::setClass() method). (Dmitry)
 - Added support for hexadecimal entity in imagettftext() for the bundled GD.
   (Pierre)
+- Fixed bug #38624 (Strange warning when incrementing an object property and 
+  exception is thrown from __get method). (Tony)
 - Fixed bug #38543 (shutdown_executor() may segfault when memory_limit is too
   low). (Dmitry)
 - Fixed bug #38535 (memory corruption in pdo_pgsql driver on error retrieval
diff --git a/Zend/tests/bug38624.phpt b/Zend/tests/bug38624.phpt
new file mode 100644 (file)
index 0000000..081e35c
--- /dev/null
@@ -0,0 +1,34 @@
+--TEST--
+Bug #38624 (Strange warning when incrementing an object property and exception is thrown from __get method)
+--FILE--
+<?php
+
+class impl
+{
+    public function __construct()
+    {
+       $this->counter++;
+    }
+    public function __set( $name, $value )
+    {
+        throw new Exception( "doesn't work" );
+    }
+
+    public function __get( $name )
+    {
+        throw new Exception( "doesn't work" );
+    }
+
+}
+
+$impl = new impl();
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Uncaught exception 'Exception' with message 'doesn't work' in %s:%d
+Stack trace:
+#0 %s(%d): impl->__get('counter')
+#1 %s(%d): impl->__construct()
+#2 {main}
+  thrown in %s on line %d
index a6a937c90c8ce4ab48b890e8d01db08b198d8478..c5badb1a6cdedf81210dc9e7d52478cf1f88ea6d 100755 (executable)
@@ -92,7 +92,9 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
                if (!obj_ce) {
                        obj_ce = object_pp ? Z_OBJCE_PP(object_pp) : NULL;
                }
-               zend_error(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? obj_ce->name : "", obj_ce ? "::" : "", function_name);
+               if (!EG(exception)) {
+                       zend_error(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? obj_ce->name : "", obj_ce ? "::" : "", function_name);
+               }
        }
        if (!retval_ptr_ptr) {
                if (retval) {