Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36433 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42439 invoked from network); 24 Mar 2008 15:07:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2008 15:07:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 38.99.98.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 38.99.98.18 beast.bluga.net Linux 2.6 Received: from [38.99.98.18] ([38.99.98.18:60468] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/A7-04656-BC3C7E74 for ; Mon, 24 Mar 2008 10:07:57 -0500 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id ADC9EC0D660; Mon, 24 Mar 2008 08:07:52 -0700 (MST) Received: from [192.168.0.106] (CPE-76-84-4-101.neb.res.rr.com [76.84.4.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 246B7C0D61F; Mon, 24 Mar 2008 08:07:52 -0700 (MST) Message-ID: <47E7C3D3.3050404@chiaraquartet.net> Date: Mon, 24 Mar 2008 10:08:03 -0500 User-Agent: Thunderbird 2.0.0.12 (X11/20080227) MIME-Version: 1.0 To: Dmitry Stogov CC: internals Mailing List , Stanislav Malyshev References: <47E2F8FA.20107@chiaraquartet.net> <47E37C42.10308@zend.com> <47E3E7F1.3060200@chiaraquartet.net> <47E792E1.9070803@zend.com> <47E7AC60.1040705@chiaraquartet.net> <47E7B89C.7060708@zend.com> <47E7BD9C.3040506@chiaraquartet.net> <47E7C36D.106@zend.com> In-Reply-To: <47E7C36D.106@zend.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] REMINDER - stream wrappers in include_path From: greg@chiaraquartet.net (Gregory Beaver) Dmitry Stogov wrote: > > > Gregory Beaver wrote: >> Dmitry Stogov wrote: >>> REALPATH_FAILED looks like a hack :( >>> PHP itself doesn't need it at all, according to your patch >>> php_stream_open() may just return NULL immediately instead of setting >>> of this flag. >>> However I am not sure that it will work for all cases. The fact that >>> we cannot resolve the path doesn't mean that we cannot open the file. >>> (On some systems getcwd() may fail on some reasons). >> I remember Solaris having issues with this, now that you mention it. >> >> However, the place that I added this already returned NULL if realpath >> fails, it doesn't change the behavior, just moves the realpath to an >> earlier position and eliminates an unnecessary double call. However, if >> we are comfortable having the double realpath on files not found in >> include_path (this would only have a performance affect on apps with >> lots of conditional loading of drivers where the majority are not >> found), this is fine with me. I've attached a patch that removes >> REALPATH_FAILED so there are options. >> >> Another option would be to determine which OSes this can fail, and >> simply not use REALPATH_FAILED on those OSes. >>> I didn't test the patch with pecl/phar. >>> Could you explain why php goes into the endless loop? >> because the cut/paste to plain_wrapper.c:1419 needs a ptr = end, unlike >> the code in fopen_wrappers.c. > > You are right. > >> Once you fix this problem, then the real >> logic problem rears its head, which is that we go into plain_wrapper to >> open an external stream wrapper. It is far less efficient (about 4-6% >> by my measurements) to do this, which is why I moved the include_path >> parsing into streams.c > > Did you measure pecl/phar or regular files? I only measured regular files, my concern is that we don't affect any existing users, 100% of whom use regular files at the moment (obviously :). > >> This bug only happens when the last item in include_path is a stream >> wrapper and the file is not found in include_path. > > In general I don't have objections except of changing > zend_resolve_path() (which is a callback for ZE) into > php_resolve_path(). Anyway I'll look into patch once again with fresh > head. > > I would also ask Stas and other interested people to look into it. Thanks Dmitry, Greg