#47402 [Opn->Asn]: call_user_func propagating the scope while it didn't in 5_2
| From: | colder@php.net | Date: | Mon, 16 Feb 2009 10:33:46 +0000 |
| Subject: | #47402 [Opn->Asn]: call_user_func propagating the scope while it didn't in 5_2 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133867@lists.php.net to get a copy of this message | ||
ID: 47402
Updated by: colder@php.net
Reported By: colder@php.net
-Status: Open
+Status: Assigned
Bug Type: Scripting Engine problem
PHP Version: 5.3.0beta1
-Assigned To:
+Assigned To: dmitry
Previous Comments:
------------------------------------------------------------------------
[2009-02-16 10:33:00] colder@php.net
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 this bug report at http://bugs.php.net/?id=47402&edit=1