Re: Re: Current working directory and multi-threaded environments
| From: | rubys at us dot ibm dot com | Date: | Thu, 16 Mar 2000 13:27:41 +0000 |
| Subject: | Re: Re: Current working directory and multi-threaded environments | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-16883@lists.php.net to get a copy of this message | ||
>> You are free to disagree with me, and I may have missed something or I
>> could very much be wrong. It just seems to me that unless more is done
>> than what you propose, examples such as the following will change
behavior:
>>
>> http://www.php.net/manual/html/function.readdir.html
>>
>> And that's an easy one. dl, ftp_get and others can be passed relative
>> paths. Fortunately, this list is finite. What would concern me most is
>> the extensions that interface to external code.
>
>Why does it change behaviour?
>
>The functions (not readdir, but opendir) will create an absolute path
>from the relative path passed to them.
I must be missing something very obvious. Excerpts from
ext/standard/dir.c:
PHP_FUNCTION(opendir):
_do_opendir(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
static void _php_do_opendir:
dirp->dir = opendir((*arg)->value.str.val);
From what I can see, a relative path coded in the web page passes directly
through to a system call. That system call will be entirely unaware of
PHP's notion of a virtual (per request and/or thread) current directory,
and will proceed to use the "real" (per process) current directory.
- Sam Ruby