cvs: ZendEngine2(PHP_5_2) / zend_execute_API.c /tests bug46246.phpt php-src NEWS
[email protected] ("Dmitry Stogov")
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsdmitry1223654012@cvsserver> |
dmitry Fri Oct 10 15:53:32 2008 UTC
Added files: (Branch: PHP_5_2)
/ZendEngine2/tests bug46246.phpt
Modified files:
/php-src NEWS
/ZendEngine2 zend_execute_API.c
Log:
Fixed bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method())
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1249&r2=1.2027.2.547.2.1250&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1249 php-src/NEWS:1.2027.2.547.2.1250
--- php-src/NEWS:1.2027.2.547.2.1249 Fri Oct 10 12:15:43 2008
+++ php-src/NEWS Fri Oct 10 15:53:31 2008
@@ -1,6 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Oct 2008, PHP 5.2.7RC2
+- Fixed bug #46246 (difference between call_user_func(array($this, $method))
+ and $this->$method()). (Dmitry)
- Fixed bug #44251, #41125 (PDO + quote() + prepare() can result in seg fault).
(tsteiner at nerdclub dot net)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.27&r2=1.331.2.20.2.28&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.27 ZendEngine2/zend_execute_API.c:1.331.2.20.2.28
--- ZendEngine2/zend_execute_API.c:1.331.2.20.2.27 Tue Mar 4 11:46:09 2008
+++ ZendEngine2/zend_execute_API.c Fri Oct 10 15:53:31 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute_API.c,v 1.331.2.20.2.27 2008/03/04 11:46:09 dmitry Exp $ */
+/* $Id: zend_execute_API.c,v 1.331.2.20.2.28 2008/10/10 15:53:31 dmitry Exp $ */
#include <stdio.h>
#include <signal.h>
@@ -824,7 +824,9 @@
}
EX(function_state).function =
Z_OBJ_HT_PP(fci->object_pp)->get_method(fci->object_pp, fname, fname_len TSRMLS_CC);
- if (EX(function_state).function && calling_scope != EX(function_state).function->common.scope) {
+ if (EX(function_state).function &&
+ (EX(function_state).function->common.fn_flags & ZEND_ACC_PRIVATE) == 0 &&
+ calling_scope != EX(function_state).function->common.scope) {
char *function_name_lc = zend_str_tolower_dup(fname, fname_len);
if (zend_hash_find(&calling_scope->function_table, function_name_lc, fname_len+1, (void **) &EX(function_state).function)==FAILURE) {
efree(function_name_lc);
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug46246.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug46246.phpt
+++ ZendEngine2/tests/bug46246.phpt
--TEST--
Bug #46246 (difference between call_user_func(array($this, $method)) and $this->$method())
--FILE--
<?php
class A
{
private function Test()
{
echo 'Hello from '.get_class($this)."\n";
}
public function call($method, $args = array())
{
$this->Test();
$this->$method();
call_user_func(array($this, $method));
}
}
class B extends A
{
protected function Test()
{
echo 'Overridden hello from '.get_class($this)."\n";
}
}
$a = new A;
$b = new B;
$a->call('Test');
$b->call('Test');
?>
--EXPECT--
Hello from A
Hello from A
Hello from A
Hello from B
Hello from B
Hello from B