On June 9, 2003 12:58 pm, Andi Gutmans wrote: > At 01:27 PM 6/4/2003 -0400, Ilia A. wrote: > >Here is an analysis of the situation as it stands with PHP 4.3.3. As far > > as I can tell that even when opening files with the full path we do a lot > > of completely unnecessary work. > > > >We start from expand_filepath() which, gets called when opening a file. > > This function does a getcwd() everytime it is called even if path is full > > (/path/to/script.php), as far as I can tell completely useless syscal. > > Two different full paths can point to the same file and not using > realpath() would break include_once() and require_once(). > We might be able to use stat() information to compare the files but it > would require some thinking.
As far as realpath() goes beyond the _once() directives and php installations where safe_mode or open_basedir are enabled it is not really needed. To handle safe_mode/open_basedir is fairly easy and mostly involves passing TSRMLS_CC to virtual_file_ex() and then putting realpath related code inside if (PG(safe_mode) || PG(open_basedir)) {. I already have a patch for this. I wonder if instead of comming up with an alternative way, which is likely to involve stat() or lstat(). We could add a flag that would allow us to identify *_once requests and make realpath conditional on that. Ilia -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php