getcwd() mismatched drive letter case for Windows directory
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Function getcwd() returns different results with php.exe and php-cgi.exe
Via php.exe it returns drive letter in upper case.
Via php-cgi.exe it returns drive letter in lower case.
The following code:
<?php
function print_backtrace()
{
print debug_backtrace()[0]["file"];
}
print getcwd() . "\n";
print_backtrace();
Resulted in this output:
via php.exe
C:\test
C:\test\test.php
but via php-cgi.exe
c:\test
C:\test\test.php
But I expected this output in both cases:
C:\test
C:\test\test.php
PHP Version
PHP 8.1.6
Operating System
Windows 11 21H2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report on Windows 11 with PHP 8.1.6 using both php.exe and php-cgi.exe, running the provided getcwd() and debug_backtrace() script. Compare the drive-letter casing in both outputs and trace the differing working-directory behavior in the PHP source. Done means both executables return the same drive-letter casing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100