ID: 47334 Updated by: il...@php.net Reported By: php at kennel17 dot co dot uk -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Win32 PHP Version: 5.2.9RC1 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php StaticFunc is not defined as static call, hence ->. Previous Comments: ------------------------------------------------------------------------ [2009-02-07 14:32:32] php at kennel17 dot co dot uk Description: ------------ The 'type' attribute returned by debug_backtrace() seems to always be set to "->" in PHP5, but was correctly set to "::" for static calls in PHP4. I have tested this on 5.2.8, 5.2.9RC1 and 5.3.0beta1 and it applies to all of these. In the example code, StaticFunc() is called statically from OtherFunc(), so the type field should contain "::", which it does in PHP4, but in PHP5 it contains "->", as you can see in the results below. Note that this also affects debug_print_backtrace(), which gives the following output: #0 MyClass->StaticFunc() called at [example.php:11] #1 MyClass->OtherFunc() called at [example.php:16] instead of what you would expect: #0 MyClass::StaticFunc() called at [example.php:11] #1 MyClass->OtherFunc() called at [example.php:16] Reproduce code: --------------- <?php class MyClass { function StaticFunc() { print_r(debug_backtrace()); } function OtherFunc() { MyClass::StaticFunc(); } } $c = new MyClass; $c->OtherFunc(); ?> Expected result: ---------------- PHP4 produces this, which is the expected result. Note the 'type' field in element [0]. Array ( [0] => Array ( [file] => example.php [line] => 11 [function] => staticfunc [class] => myclass [type] => :: [args] => Array ( ) ) [1] => Array ( [file] => example.php [line] => 16 [function] => otherfunc [class] => myclass [type] => -> [args] => Array ( ) ) ) Actual result: -------------- PHP5 gives the following: Array ( [0] => Array ( [file] => example.php [line] => 11 [function] => StaticFunc [class] => MyClass [object] => MyClass Object ( ) [type] => -> [args] => Array ( ) ) [1] => Array ( [file] => example.php [line] => 16 [function] => OtherFunc [class] => MyClass [object] => MyClass Object ( ) [type] => -> [args] => Array ( ) ) ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47334&edit=1