From:             bksmith at windlogics dot com
Operating system: Windows 2000
PHP version:      4.3.6
PHP Bug Type:     Program Execution
Bug description:  CLI scripts specified with UNC paths using system() have Win. 
default work. dir

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


-- 
Edit bug report at http://bugs.php.net/?id=28101&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28101&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28101&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28101&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28101&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28101&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28101&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28101&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28101&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28101&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28101&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28101&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28101&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28101&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28101&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28101&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28101&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28101&r=float

Reply via email to