php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31687 Exception::getTrace() breaks backward compatibility
Submitted: 2005-01-25 13:25 UTC Modified: 2005-02-28 20:23 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: guth at fiifo dot u-psud dot fr Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.0.3 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: guth at fiifo dot u-psud dot fr
New email:
PHP Version: OS:

 

 [2005-01-25 13:25 UTC] guth at fiifo dot u-psud dot fr
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
                (
                )

        )

)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-28 20:23 UTC] sniper@php.net
And what does it help if it's changed again? Won't fix.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 01:01:35 2025 UTC