Bug #73797 [Com]: __DIR__ !== getcwd()

From: Date: Wed, 21 Dec 2016 04:26:40 +0000
Subject: Bug #73797 [Com]: __DIR__ !== getcwd()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206171@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73797&edit=1 ID: 73797 Comment by: anrdaemon at freemail dot ru Reported by: anrdaemon at freemail dot ru Summary: __DIR__ !== getcwd() Status: Open Type: Bug Package: Filesystem function related Operating System: Windows PHP Version: 7.1.0 Block user comment: N Private report: N New Comment: Another interesting script to run in this directory: <?php print getcwd() . "\n"; chdir(getcwd()); print getcwd() . "\n"; chdir(getcwd()); print getcwd() . "\n"; chdir(getcwd()); print getcwd() . "\n"; Previous Comments: ------------------------------------------------------------------------ [2016-12-21 03:32:23] anrdaemon at freemail dot ru Description: ------------ When running script from the current directory, you can't be sure if __DIR__ will match getcwd(), even if naive logic says they should be. Test script: --------------- mklink /J "%TEMP%\test.dir" "C:\Documents and Settings\Public\Desktop" cd "%TEMP%\test.dir" echo ^<^?php print __DIR__ . ^"\n^"; print getcwd() . ^"\n^"; > test.php C:\php\php.exe -f test.php Expected result: ---------------- I'm fully expecting equal output from both prints. Actual result: -------------- Actually, the output differs, as if __DIR__ is realpath()'d for some reason. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73797&edit=1

« previous php.bugs (#206171) next »