#31687 [NEW]: Exception::getTrace() breaks backward compatibility

From: Date: Tue, 25 Jan 2005 12:25:33 +0000
Subject: #31687 [NEW]: Exception::getTrace() breaks backward compatibility
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-72779@lists.php.net to get a copy of this message
From:             guth at fiifo dot u-psud dot fr
Operating system: *
PHP version:      5.0.3
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Exception::getTrace() breaks backward compatibility

Description:
------------
hello

Behaviour of Exception::getTrace() has changed in PHP 5.0.3.
There is no mention of this in the PHP ChangeLog, it is a PHP bug.

In PHP 5.0.2, Exception::getTrace() returned the same backtrace than
debug_backtrace().
In PHP 5.0.3, this is broken and Exception::getTrace() return a different
array.

Reproduce code:
---------------
<?php
function A() {

	throw new exception;

}

try {
	A();
}
catch(Exception $e) {
	print_r($e->getTrace());
}

?>

<?php
function A() {

	print_r(debug_backtrace());

}


A();

?>

Expected result:
----------------
PHP 5.0.2 (for both reproduce codes)  :

Array
(
    [0] => Array
        (
            [file] => /anticorps/www/test.php
            [line] => 9
            [function] => A
            [args] => Array
                (
                )

        )

)

Actual result:
--------------
PHP 5.0.3 :

First code :

Array
(
    [0] => Array
        (
            [file] => /anticorps/www/test.php
            [line] => 4
            [function] => A
        )

    [1] => Array
        (
            [file] => /anticorps/www/test.php
            [line] => 9
            [function] => A
            [args] => Array
                (
                )

        )

)


Second code :

Array
(
    [0] => Array
        (
            [file] => /anticorps/www/test.php
            [line] => 9
            [function] => A
            [args] => Array
                (
                )

        )

)


-- 
Edit bug report at http://bugs.php.net/?id=31687&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=31687&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31687&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31687&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=31687&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=31687&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=31687&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=31687&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=31687&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=31687&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=31687&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=31687&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=31687&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=31687&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=31687&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=31687&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=31687&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=31687&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=31687&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=31687&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=31687&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#72779) next »