-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed as not planned
Closed as not planned
Copy link
Description
Description
The following code:
<?php
class Test
{
public function run(int $v)
{
$v = 2;
var_export(debug_backtrace(limit: 1));
}
}
(new Test())->run(1);
Resulted in this output:
array (
0 => array (
'file' => 'test.php',
'line' => 12,
'function' => 'run',
'class' => 'Test',
'object' => \Test::__set_state(array()),
'type' => '->',
'args' => array (0 => 2,),
),
)
But I expected this output instead:
array (
0 => array (
'file' => 'test.php',
'line' => 12,
'function' => 'run',
'class' => 'Test',
'object' => \Test::__set_state(array()),
'type' => '->',
'args' => array (0 => 1,),
),
)
From docs:
args If inside a function, this lists the functions arguments.
I.e. args
must contain passed argument (1) instead current value of $v
(2)
PHP Version
PHP 8.3.14 (cli) (built: Nov 20 2024 21:06:22) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.14, Copyright (c) Zend Technologies
with Zend OPcache v8.3.14, Copyright (c), by Zend Technologies
Operating System
Windows 11