|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77224 Stack Trace shows wrong parameter value
Submitted: 2018-11-30 09:45 UTC Modified: 2018-12-06 09:38 UTC
From: fkruidhof at mailbox dot org Assigned:
Status: Closed Package: Testing related
PHP Version: 7.2.12 OS: MacOs Mojave
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: fkruidhof at mailbox dot org
New email:
PHP Version: OS:


 [2018-11-30 09:45 UTC] fkruidhof at mailbox dot org
The stack trace from an exception shows the wrong value of the parameter that was passed to a function if it's value is changed inside that function (before the exception is thrown).

First bug report, novice PHP developer. Apologies if I miscategorized this report.

Test script:
$variable = 'foo';

function one($variable)
    try {
    } catch (Exception $e) {
        echo $e->getTraceAsString();

function two($variable)
    $variable = 'bar';
    throw new Exception('problem');

Expected result:
Stack trace output:
#0 /file.php(8): two('foo')
#1 /file.php(3): one('foo')
#2 {main}

Actual result:
Stack trace output:
#0 /file.php(8): two('bar')
#1 /file.php(3): one('foo')
#2 {main}


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-30 09:52 UTC]
This is one of the unfortunate changes resulting from optimizations in PHP 7. It's noted in the PHP 7 migration guide here:

It's a known issue, but as far as I'm aware there is no work towards improving this (if it can be improved).
 [2018-12-06 09:38 UTC] fkruidhof at mailbox dot org
-Status: Open +Status: Closed
 [2018-12-06 09:38 UTC] fkruidhof at mailbox dot org
Thank you for your reply.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Oct 30 01:01:23 2020 UTC