php / php/php-src

Show symlinks in stack trace file paths

Open
#15,000 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Category: Engine Feature Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description
Summary

Stack trace (from debug_backtrace(), exceptions, errors ..) shows always absolute/real/evaluated file paths, even though the script was run from symlink context.

How to reproduce
  1. Create a directory "d2" and a symlink to that directory "d1"
mkdir D:\d2
mklink /D "D:\d1" "D:\d2"
  1. Create a "D:\d2\test.php" script
<?php

var_dump($argv);

(function(){
	  var_dump(debug_backtrace());
})();
  1. Run the script using symlink path
    php.exe D:\d1\test.php
Current behavior
array(1) {
  [0]=>
  string(14) "D:\d1\test.php"
}
array(1) {
  [0]=>
  array(4) {
    ["file"]=>
    string(14) "D:\d2\test.php"
    ["line"]=>
    int(8)
    ["function"]=>
    string(9) "{closure}"
    ["args"]=>
    array(0) {
    }
  }
}
Expected behavior
array(1) {
  [0]=>
  string(14) "D:\d1\test.php"
}
array(1) {
  [0]=>
  array(4) {
    ["file"]=>
    string(14) "D:\d1\test.php"
    ["line"]=>
    int(8)
    ["function"]=>
    string(9) "{closure}"
    ["args"]=>
    array(0) {
    }
  }
}
...
PHP Version

8.3.9

Operating System

Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the Windows reproduction with php.exe, debug_backtrace(), exceptions, and errors as the starting entry points. Compare argv and stack-trace file paths when invoking D:\d1\test.php through the symlink. Done means the reported paths consistently retain the symlink path for the described cases, with existing behavior checked for regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.