Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51568 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90669 invoked from network); 4 Mar 2011 18:06:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Mar 2011 18:06:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=mozo@mozo.jp; spf=permerror; sender-id=permerror Authentication-Results: pb1.pair.com header.from=mozo@mozo.jp; sender-id=permerror Received-SPF: error (pb1.pair.com: domain mozo.jp from 209.85.216.42 cause and error) X-PHP-List-Original-Sender: mozo@mozo.jp X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:64090] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C4/E2-11441-11A217D4 for ; Fri, 04 Mar 2011 13:06:11 -0500 Received: by qwd6 with SMTP id 6so1875894qwd.29 for ; Fri, 04 Mar 2011 10:06:07 -0800 (PST) Received: by 10.224.76.16 with SMTP id a16mr930194qak.160.1299261967005; Fri, 04 Mar 2011 10:06:07 -0800 (PST) Received: from [192.168.0.128] (i114-184-197-23.s41.a014.ap.plala.or.jp [114.184.197.23]) by mx.google.com with ESMTPS id g32sm1853669qck.46.2011.03.04.10.06.02 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 10:06:03 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii In-Reply-To: <4D703FBC.3080006@sugarcrm.com> Date: Sat, 5 Mar 2011 03:05:57 +0900 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <4D703FBC.3080006@sugarcrm.com> To: Stas Malyshev X-Mailer: Apple Mail (2.1082) Subject: Re: [PHP-DEV] streams problem in 5.3 From: mozo@mozo.jp (Moriyoshi Koizumi) It looks like the only solution is define a new stream type for = zend_stream that delegates stream operations to user-defined callbacks. Moriyoshi On 2011/03/04, at 10:26, Stas Malyshev wrote: > Hi! >=20 > I try to do some complex code with custom streams and I have = discovered the following problem: >=20 > The code in main/streams/cast.c, specifically _php_stream_cast, = creates fopencookie() synthetic stream for streams that are not actual = file streams. Which works fine until such stream is used in include(), = in which case it ultimately arrives at zend_stream_fixup(). Which would = in turn call zend_stream_fsize() - which would do = fstat(fileno(file_handle->handle.fp), &buf) - and that would fail since = you can't get fileno for FILE* created by fopencookie. > Which ultimately means I can't use my custom streams for include(), = which is bad. Now, looking at the code, it doesn't actually need the = exact size - http streams can be included just fine - but insists on = having it if it has fp (which it can have for basically any kind of = stream due to the cookie trick). Does anyone has any idea why and if it = can be fixed? > --=20 > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20