|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-10-04 14:16 UTC] bwoebi@php.net
-Status: Open
+Status: Not a bug
[2015-10-04 14:16 UTC] bwoebi@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 20:00:02 2026 UTC |
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) { } } }