Edit report at http://bugs.php.net/bug.php?id=45620&edit=1
ID: 45620 Updated by: fel...@php.net Reported by: kelvin at netbasic dot co dot uk Summary: Stacktrace reports wrong call type for static methods called from non-static -Status: No Feedback +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: CentOS 5 PHP Version: 5.2.6 New Comment: This behavior is expected, because the method is called by passing $this when it isn't explicity declared static. Previous Comments: ------------------------------------------------------------------------ [2009-01-30 01:00:06] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2009-01-22 01:12:10] j...@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2008-08-05 02:08:35] coen at bluedogtraining dot com dot au This is not just a stacktrace problem. If you were to attempt use '$this' in funcB you would find that '$this' is actually available and is an instance of class testA. I stumbled on this accidentally. <?php class testA { public function funcA() { testB::funcB(); } } class testB { public function funcB() { echo get_class($this); } } $obj = new testA(); $obj->funcA(); ?> Expected result: ---------------- nothing Actual result: -------------- testA It appears as though the static method is being executed in the context of the calling object. Strange behaviour. ------------------------------------------------------------------------ [2008-07-25 02:45:45] kelvin at netbasic dot co dot uk Description: ------------ When calling a static function from inside of a class the backtrace / stacktrace reports the call as a normal object call, i.e. its showing ->, where it really should show :: Reproduce code: --------------- <?php class testA { public function funcA() { testB::funcB(); } } class testB { public function funcB() { echo "<pre>"; debug_print_backtrace(); echo "</pre>"; } } $obj = new testA(); $obj->funcA(); ?> Expected result: ---------------- #0 testB::funcB() called at [/home/site3/public_html/t1.php:7] #1 testA->funcA() called at [/home/site3/public_html/t1.php:23] Actual result: -------------- #0 testB->funcB() called at [/home/site3/public_html/t1.php:7] #1 testA->funcA() called at [/home/site3/public_html/t1.php:23] ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=45620&edit=1