Re: Re: Current working directory and multi-threadedenvironments

From: Date: Thu, 16 Mar 2000 14:05:44 +0000
Subject: Re: Re: Current working directory and multi-threadedenvironments
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-16885@lists.php.net to get a copy of this message
> > 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. That's solved by calling an internal function to get the virtual current directory, and creating a new string with the full path to opendir. Of course, that would only be done in the case that the parameter passed to the php function is a relative path. do_opendir: if relative directory get virtual current directory concate virtual and relative into newstring else newstring = parameter end if opendir newstring More the issue to me would be the exec functions. Under windows i beleive you can pass a working directory to the exec functions, but I'm not sure about that under unix.

« previous php.dev (#16885) next »