ID:               29005
 Comment by:       bob at peret dot net
 Reported By:      cleong at nflc dot org
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Windows 2000
 PHP Version:      4.3.6
 New Comment:

I got around this by replacing the "." with my local address

"\\\\.\\pipe\\pipename"

"\\\\127.0.0.1\\pipe\\pipename"


Previous Comments:
------------------------------------------------------------------------

[2004-07-06 16:47:11] cleong at nflc dot org

But it's just a matter of not corrupting the filepath. This is a bug in
a way, as, for the same reason, the function cannot handle
"\\.\C:\filename.ext", which is a valid Win32 path.

------------------------------------------------------------------------

[2004-07-06 16:32:20] poll...@php.net

Indeed, Wez and I both have our eyes on named pipe support.  With luck
it'll show up in 5.1, in any case it should be a simple backport to make
it available to 5.0 via a PECL extension.

------------------------------------------------------------------------

[2004-07-05 09:49:10] der...@php.net

Let's make this a feature request as it's currently not meant to work.

------------------------------------------------------------------------

[2004-07-04 00:06:58] cleong at nflc dot org

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 this bug report at http://bugs.php.net/?id=29005&edit=1

Reply via email to