Bug #70634 [Opn->Nab]: debug_backtrace() return value changed
| From: | bwoebi@php.net | Date: | Sun, 04 Oct 2015 14:16:29 +0000 |
| Subject: | Bug #70634 [Opn->Nab]: debug_backtrace() return value changed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196387@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70634&edit=1
ID: 70634
Updated by: bwoebi@php.net
Reported by: kenji dot uui at gmail dot com
Summary: debug_backtrace() return value changed
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Linux
PHP Version: 7.0.0RC4
Block user comment: N
Private report: N
New Comment:
Yeah, the Proxy::bar() disappeared and is now immediately going to Proxy::__callStatic(). This is
the result of an optimization (trampolines), which causes the VM in PHP 7 to immediately call the
__callStatic().
Previous Comments:
------------------------------------------------------------------------
[2015-10-04 10:33:45] kenji dot uui at gmail dot com
Description:
------------
The return value of debug_backtrace() was changed since php7.
Test script:
---------------
$ cat Proxy.php
<?php
class Proxy
{
public static function __callStatic($function, array $arguments)
{
if (self::checkCalledMethod($function))
{
}
}
public static function checkCalledMethod($function)
{
$trace = debug_backtrace();
var_dump($trace);
}
}
----- ----- ----- -----
$ cat Test.php
<?php
class Test
{
public function run()
{
Proxy::bar();
}
}
----- ----- ----- -----
$ cat app.php
<?php
require './Test.php';
require './Proxy.php';
$test = new Test();
$test->run();
----- ----- ----- -----
$ php app.php
Expected result:
----------------
PHP 5.6.10-dev
array(4) {
[0]=>
array(6) {
["file"]=>
string(34) "/vagrant/debug_backtrace/Proxy.php"
["line"]=>
int(7)
["function"]=>
string(17) "checkCalledMethod"
["class"]=>
string(5) "Proxy"
["type"]=>
string(2) "::"
["args"]=>
array(1) {
[0]=>
&string(3) "bar"
}
}
[1]=>
array(6) {
["file"]=>
string(33) "/vagrant/debug_backtrace/Test.php"
["line"]=>
int(7)
["function"]=>
string(12) "__callStatic"
["class"]=>
string(5) "Proxy"
["type"]=>
string(2) "::"
["args"]=>
array(2) {
[0]=>
&string(3) "bar"
[1]=>
&array(0) {
}
}
}
[2]=>
array(6) {
["file"]=>
string(33) "/vagrant/debug_backtrace/Test.php"
["line"]=>
int(7)
["function"]=>
string(3) "bar"
["class"]=>
string(5) "Proxy"
["type"]=>
string(2) "::"
["args"]=>
array(0) {
}
}
[3]=>
array(7) {
["file"]=>
string(32) "/vagrant/debug_backtrace/app.php"
["line"]=>
int(7)
["function"]=>
string(3) "run"
["class"]=>
string(4) "Test"
["object"]=>
object(Test)#1 (0) {
}
["type"]=>
string(2) "->"
["args"]=>
array(0) {
}
}
}
Actual result:
--------------
PHP 7.0.0-dev
array(3) {
[0]=>
array(6) {
["file"]=>
string(34) "/vagrant/debug_backtrace/Proxy.php"
["line"]=>
int(7)
["function"]=>
string(17) "checkCalledMethod"
["class"]=>
string(5) "Proxy"
["type"]=>
string(2) "::"
["args"]=>
array(1) {
[0]=>
string(3) "bar"
}
}
[1]=>
array(6) {
["file"]=>
string(33) "/vagrant/debug_backtrace/Test.php"
["line"]=>
int(7)
["function"]=>
string(12) "__callStatic"
["class"]=>
string(5) "Proxy"
["type"]=>
string(2) "::"
["args"]=>
array(2) {
[0]=>
string(3) "bar"
[1]=>
array(0) {
}
}
}
[2]=>
array(7) {
["file"]=>
string(32) "/vagrant/debug_backtrace/app.php"
["line"]=>
int(7)
["function"]=>
string(3) "run"
["class"]=>
string(4) "Test"
["object"]=>
object(Test)#1 (0) {
}
["type"]=>
string(2) "->"
["args"]=>
array(0) {
}
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70634&edit=1