Re: svn: /php/php-src/branches/PHP_5_4/Zend/ tests/bug54910.phpt zend_API.c

From: Date: Tue, 07 Jun 2011 18:10:09 +0000
Subject: Re: svn: /php/php-src/branches/PHP_5_4/Zend/ tests/bug54910.phpt zend_API.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-65138@lists.php.net to get a copy of this message
Dmitry, Can you add this to NEWS? Thanks, Chris On 05/31/2011 04:36 AM, Dmitry Stogov wrote:
dmitry                                   Tue, 31 May 2011 11:36:57 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=311653 Log: MFH: Fixed bug #54910 (Crash when calling call_user_func with unknown function name) Bug: http://bugs.php.net/54910 (Closed) Crash when calling call_user_func with unknown function name Changed paths:
     A   php/php-src/branches/PHP_5_4/Zend/tests/bug54910.phpt
     U   php/php-src/branches/PHP_5_4/Zend/zend_API.c
Added: php/php-src/branches/PHP_5_4/Zend/tests/bug54910.phpt ===================================================================
--- php/php-src/branches/PHP_5_4/Zend/tests/bug54910.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_4/Zend/tests/bug54910.phpt 2011-05-31 11:36:57 UTC (rev 311653) @@ -0,0 +1,28 @@ +--TEST-- +Bug #54910 (Crash when calling call_user_func with unknown function name) +--FILE-- +<?php +class A {
+    public function __call($method, $args) {
+        if (stripos($method, 'get') === 0) {
+            return $this->get();
+        }
+        die("No such method - '$method'\n");
+    }
+
+    protected function get() {
+        $class = get_class($this);
+        $call = array($class, 'noSuchMethod');
+
+        if (is_callable($call)) {
+            call_user_func($call);
+        }
+    }
+} + +class B extends A {} + +$input = new B(); +echo $input->getEmail(); +--EXPECT-- +No such method - 'noSuchMethod' Modified: php/php-src/branches/PHP_5_4/Zend/zend_API.c =================================================================== --- php/php-src/branches/PHP_5_4/Zend/zend_API.c 2011-05-31 11:28:37 UTC (rev 311652) +++ php/php-src/branches/PHP_5_4/Zend/zend_API.c 2011-05-31 11:36:57 UTC (rev 311653) @@ -2773,6 +2773,11 @@ if (fcc->function_handler) { retval = 1; call_via_handler = (fcc->function_handler->common.fn_flags& ZEND_ACC_CALL_VIA_HANDLER) != 0; + if (call_via_handler&& !fcc->object_ptr&& EG(This)&&
+				    Z_OBJ_HT_P(EG(This))->get_class_entry&&
+				    instanceof_function(Z_OBJCE_P(EG(This)), fcc->calling_scope TSRMLS_CC)) {
+ fcc->object_ptr = EG(This); + } } } }
-- Email: christopher.jones@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/

« previous php.cvs (#65138) next »