From:             php at kennel17 dot co dot uk
Operating system: Win32
PHP version:      5.2.9RC1
PHP Bug Type:     Unknown/Other Function
Bug description:  debug_backtrace() gives incorrect 'type' value

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 bug report at http://bugs.php.net/?id=47334&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47334&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47334&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47334&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47334&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47334&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47334&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47334&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47334&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47334&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47334&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47334&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47334&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47334&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47334&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47334&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47334&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47334&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47334&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47334&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47334&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47334&r=mysqlcfg

Reply via email to