From: cleong at nflc dot org Operating system: Windows 2000 PHP version: 4.3.6 PHP Bug Type: Filesystem function related Bug description: fopen() can't open NT named pipes on local computer
Description: ------------ fopen() can't handle path names like "\\.\pipe\pipename" because the internal function virtual_file_ex() see the ".\" part, thinks that it means current directory, and promptly removes it. The manual doesn't mention named pipes but I think this is worth fixing as it will give PHP Win32 a robust interprocess communication mechanism that's fairly easy to implement. The fix is easy enough. Insert the following at line 413 in tsrm_virtual_cwd.c, right after the else if (!IS_DIRECTORY_CURRENT(ptr, ptr_length)) loop: #ifdef TSRM_WIN32 /* '.' should be retained if the first two chars are '\' as it stands for local machine done mainly for paths to NT named pipes (\\.\pipe\pipename) */ } else if(state->cwd_length == 2 && state->cwd[0] == '\\' && state->cwd[1] == '\\') { state->cwd = (char *) realloc(state->cwd, state->cwd_length+ptr_length+1); memcpy(&state->cwd[state->cwd_length], ptr, ptr_length+1); state->cwd_length += ptr_length; #endif } Reproduce code: --------------- Set break point at line 1975 in streams.c fd = open(realpath, open_flags, 0666); then run <? readfile('\\\\.\\pipe\\pipename'); ?>. Inspect realpath. Expected result: ---------------- realpath => \\.\pipe\pipename Actual result: -------------- realpath => \\pipe\pipename -- Edit bug report at http://bugs.php.net/?id=29005&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29005&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29005&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29005&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29005&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29005&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29005&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29005&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29005&r=support Expected behavior: http://bugs.php.net/fix.php?id=29005&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29005&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29005&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29005&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29005&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29005&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29005&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29005&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29005&r=float