|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-04-22 08:16 UTC] edink@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 05:00:01 2025 UTC |
Description: ------------ When a CLI script passed to the php interpreter with a UNC path, the system(program, return value) function call does not function in the same way as it does when a CLI script is passed to the interpreter with a non-UNC path. The problem seems to be that php bases its idea of the working directory on the path to the script it is running, rather than the directory in which php was run. This makes sense in the context of a web server, but does not seem to make sense on the command line. The example provided does not fail due to this problem because of the example's extreme simplicity, but illustrates the error message provided by CMD.exe when this issue arises. One can easily imagine instances where a script makes assumptions about working directory that are invalid when the working directory becomes C:\WINNT\SYSTEM32 or the like. For programmers attempting to migrate from other languages, it may be confusing that the working directory is not actually the directory they are working in. Reproduce code: --------------- <?php $retString = system("echo what", $retVal); ?> Expected result: ---------------- E:\WIND_PRODUCTION\bin>php test.php Content-type: text/html X-Powered-By: PHP/4.3.6 what Actual result: -------------- E:\WIND_PRODUCTION\bin>php \\37bananas\work\WIND_PRODUCTION\bin\test.php CMD.EXE was started with '\\37bananas\work\WIND_PRODUCTION\bin' as the current d irectory path. UNC paths are not supported. Defaulting to Windows directory. Content-type: text/html X-Powered-By: PHP/4.3.6 what