cvs: ZendEngine2 / zend_interfaces.c /tests bug47699.phpt
[email protected] ("Dmitry Stogov") Wed, 25 Mar 2009 10:39:36 -0000
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsdmitry1237977576@cvsserver> |
dmitry Wed Mar 25 10:39:36 2009 UTC
Modified files:
/ZendEngine2 zend_interfaces.c
/ZendEngine2/tests bug47699.phpt
Log:
Fixed bug #47699 (autoload and late static binding)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_interfaces.c?r1=1.76&r2=1.77&diff_format=u
Index: ZendEngine2/zend_interfaces.c
diff -u ZendEngine2/zend_interfaces.c:1.76 ZendEngine2/zend_interfaces.c:1.77
--- ZendEngine2/zend_interfaces.c:1.76 Wed Dec 31 11:12:29 2008
+++ ZendEngine2/zend_interfaces.c Wed Mar 25 10:39:36 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_interfaces.c,v 1.76 2008/12/31 11:12:29 sebastian Exp $ */
+/* $Id: zend_interfaces.c,v 1.77 2009/03/25 10:39:36 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -85,7 +85,15 @@
fcic.function_handler = *fn_proxy;
}
fcic.calling_scope = obj_ce;
- fcic.called_scope = object_pp ? obj_ce : EG(called_scope);
+ if (object_pp) {
+ fcic.called_scope = Z_OBJCE_PP(object_pp);
+ } else if (obj_ce &&
+ !(EG(called_scope) &&
+ instanceof_function(EG(called_scope), obj_ce TSRMLS_CC))) {
+ fcic.called_scope = obj_ce;
+ } else {
+ fcic.called_scope = EG(called_scope);
+ }
fcic.object_ptr = object_pp ? *object_pp : NULL;
result = zend_call_function(&fci, &fcic TSRMLS_CC);
}
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug47699.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug47699.phpt
diff -u /dev/null ZendEngine2/tests/bug47699.phpt:1.2
--- /dev/null Wed Mar 25 10:39:36 2009
+++ ZendEngine2/tests/bug47699.phpt Wed Mar 25 10:39:36 2009
@@ -0,0 +1,18 @@
+--TEST--
+Bug #47699 (autoload and late static binding)
+--FILE--
+<?php
+class A {
+ static function test($v='') {
+ print_r(get_called_class());
+ }
+}
+class B extends A {
+}
+B::test();
+spl_autoload_register('B::test');
+new X();
+?>
+--EXPECTF--
+BB
+Fatal error: Class 'X' not found in %sbug47699.php on line %d