From: [email protected]
Operating system:
PHP version: 5.3.0beta1
PHP Bug Type: Scripting Engine problem
Bug description: call_user_func propagating the scope while it didn't in 5_2
Description:
------------
Depending on the context and the callback, call_user_func didn't propagate
$this in 5_2. It now does in 5_3. Not sure which one is more correct, but
there is definitely a potential BC break here.
Reproduce code:
---------------
<?php
class A {
public function test() {
B::foo();
call_user_func(array("B", "foo"));
}
}
class B extends A {
public function foo() {
var_dump($this);
}
}
$b = new B; $b->test();
?>
Expected result:
----------------
// 5_2's output
object(B)#1 (0) {
}
NULL
Actual result:
--------------
// 5_3's output
object(B)#1 (0) {
}
object(B)#1 (0) {
}
--
Edit bug report at http://bugs.php.net/?id=47402&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47402&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47402&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47402&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47402&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=47402&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47402&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=47402&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=47402&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=47402&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=47402&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=47402&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=47402&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=47402&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47402&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47402&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47402&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=47402&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=47402&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=47402&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=47402&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=47402&r=mysqlcfg