Re: REMINDER - stream wrappers in include_path

From: Date: Mon, 24 Mar 2008 11:39:13 +0000
Subject: Re: REMINDER - stream wrappers in include_path
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-36420@lists.php.net to get a copy of this message
Hi Greg, In your second patch you forgot "break", so it couldn't work. I don't see any reason in second patch at all, because you call php_resolve_patch() from _php_stream_open_wrapper_ex() anyway. The bad thing with the first part that it calls realpath() function twice for each include("relative_path.php") and it makes several file-system accesses (look into strace ... 2>&1| grep lstat). With your patch I see 6 syscalls more. So I would prefer my patch that is more efficient for regular files. The same patch with fixed white-spaces is attached. Thanks. Dmitry. Gregory Beaver wrote: > Dmitry Stogov wrote: >> Hi Greg, >> >> I've fixed your patch to work with all functions (fopen, >> file_get_contente). >> Please verify it with ext/phar and then I'll commit it. >> >> Thanks. Dmitry. >> >> Gregory Beaver wrote: >>> Hi, >>> >>> Please look at the stream wrappers in include_path patch I posted >>> last week. >>> >>> Thanks, >>> Greg >>> > Hi Dmitry, > > the patch has a few major problems and a few minor ones. First off, > there are spaces instead of tabs, which is not a huge deal, I've > corrected that in the attached patch. > > It is, however, logically void to do stream wrapper operations in > plain_wrapper.c. I removed that code entirely. Instead, the path > resolve is now done in php_stream_open_wrapper_ex where it belongs, > before determining which stream wrapper to open. This will result in a > double call to the function when calling include, but because the 2nd > call will simply return after determining it has received a full path. > > I've attached 2 patches (apparently, Zend is not included in cvs diff -u > of php5), 1 for adding path resolution to include/require (this is a > significant performance improvement over the existing code). The second > patch adds stream wrapper support to both php_resolve_path and > _php_stream_open_wrapper_ex, which automatically gives stream wrapper in > include_path support to all current and future functions that use > include_path. > > Greg

« previous php.internals (#36420) next »