From:             fkruidhof at mailbox dot org
Operating system: MacOs Mojave
PHP version:      7.2.12
Package:          Testing related
Bug Type:         Bug
Bug description:Stack Trace shows wrong parameter value

Description:
------------
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:
---------------
<?php
$variable = 'foo';
one($variable);

function one($variable)
{
    try {
        two($variable);
    } 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}

-- 
Edit bug report at https://bugs.php.net/bug.php?id=77224&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=77224&r=trysnapshot54
Try a snapshot (PHP 5.5):   
https://bugs.php.net/fix.php?id=77224&r=trysnapshot55
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=77224&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=77224&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=77224&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=77224&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=77224&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=77224&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=77224&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=77224&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=77224&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=77224&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=77224&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77224&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=77224&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=77224&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=77224&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77224&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=77224&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=77224&r=mysqlcfg

Reply via email to