Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100824 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74852 invoked from network); 5 Oct 2017 10:43:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Oct 2017 10:43:07 -0000 Authentication-Results: pb1.pair.com header.from=nyamsprod@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nyamsprod@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.50 as permitted sender) X-PHP-List-Original-Sender: nyamsprod@gmail.com X-Host-Fingerprint: 209.85.214.50 mail-it0-f50.google.com Received: from [209.85.214.50] ([209.85.214.50:52511] helo=mail-it0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/39-34435-7BC06D95 for ; Thu, 05 Oct 2017 06:43:03 -0400 Received: by mail-it0-f50.google.com with SMTP id c195so779025itb.1 for ; Thu, 05 Oct 2017 03:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=irmJ87SCtIhz1zFQaA4K0/iTU5wcAnk7pYFYYBGkK6w=; b=Cj75BrbXiY0agY0OBmqiYRSdBDGeiZU4S/QvjPpDir0+JUI18NASLRcS+dfLUsDxpb mSKO6hCGnp65EUAID8IyW4tD7NLEDE+LVObchzx/DEDV0/Htc0d3FSCLfOky6xTTe3ZC y98l71NQ3TeWwuNEFm5Kuk0oNjnWIcympR/8cHej8EDBQpuXuyzb+gncr5Z2UX2jFBmV wm9EMbwHj1uEfBJbwVpHbm928GmDPUfAEbbQoZRt29VYOSnnpdIaMZQia5UO3noD3yvJ qcxnbi9x5EKjzoO33yMY9Pz/J1GZO8VzxO2lfLbomHDQZbURtQKAbJg+TRzt88G8Z55O DAEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=irmJ87SCtIhz1zFQaA4K0/iTU5wcAnk7pYFYYBGkK6w=; b=NZHZn5CuAkk3i9pK2d70FT+0+FX88kEehZOz98trsYcPjdHNPdfb792am1Syw31OSy R6TRITgc3JF23xVtDAWnUuH+D0FvWxsYV+APNrleyysDFgLIxlPUEH+2XluNry5lJqJZ 2uznb2GE3aDJBmo2+xYp6+z3BuQUhAqJkwWDLygT74g4QXImDuwGWanlj0gNvE9WcxZ6 QrzQKO7l3Pwsqd+q7D5laZj0FWveLpV2iW041xNMyHZ+WOtgENZcONuMz+l+uT1zZzRN 19/ZW64YhwlyYSWeJg1al1fcQjm1gXmfqZcNyBlgQoHoVG8PlpaN9VUVfn9hyCVKR1ak b2JQ== X-Gm-Message-State: AHPjjUjxl1alm6t5WfY7s7eQV9XLmjuT0KJSQYJ3GJv6peun3+3dVv+t +qusSwr/J1u/r6hVBacK9lE7j3rqXTLl0CiRvI71KA== X-Google-Smtp-Source: AOwi7QCkXXJShnf3BzDnoyZ33ZZQJrjZQXwFOxGmFtNDTLUdaQsZYytY6gxS9U/NCLSukPkrxDzIgfH+T+1yBLpIvwM= X-Received: by 10.36.123.144 with SMTP id q138mr29925813itc.3.1507200180130; Thu, 05 Oct 2017 03:43:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.204.71 with HTTP; Thu, 5 Oct 2017 03:42:59 -0700 (PDT) In-Reply-To: References: Date: Thu, 5 Oct 2017 12:42:59 +0200 Message-ID: To: Sara Golemon Cc: Dan Ackroyd , "internals@lists.php.net" Content-Type: multipart/alternative; boundary="001a114753a257975d055aca632a" Subject: Re: [PHP-DEV] Making stream functions accepting SplFileObject as valid parameter From: nyamsprod@gmail.com (ignace nyamagana butera) --001a114753a257975d055aca632a Content-Type: text/plain; charset="UTF-8" Does adding new methods to SplFileObject easier ? It would mean adding a getMetaData() (to return stream_get_meta_data infos) method and (append/prepend/remove)Filter methods to add stream filters API. On Tue, Oct 3, 2017 at 5:21 PM, Sara Golemon wrote: > On Tue, Oct 3, 2017 at 9:44 AM, Dan Ackroyd > wrote: > > On 29 September 2017 at 07:46, nyamsprod the funky webmaster > > wrote: > >> > >> I've been following the resolution of this bug: > >> > >> https://bugs.php.net/bug.php?id=44392 > >> > >> and it seems that there is no safe way to expose the internal > >> `SplFileObject` filepointer. > > > > > > It seems that people are scared to comment on a streams related > question... > > > Nah, just distr... OOH SHINY! > > > I'm not sure that making stream_* functions accept SplFileObject's > > would be an appropriate way to solve this problem; it's just too much > > of a hack. > > > Implementation wise, about as difficult as you'd imagine. We have > php_stream_from_zval() which is a central place which could be made > smarter, though most (all?) stream related functions have IS_RESOURCE > checks that'd have to be dealt with, so it still means touching the > world. > > > However, although it's not safe to expose the underlying file handle > > used by SplFileObject, I think it _might_ be safe to allow the > > SplFileObject to return a stream that represents the file, but with > > the necessary php_stream_ops that aren't safe to use replaced with NOP > > operations, similar to how it is done in the pgsql extension: > > https://github.com/php/php-src/blob/879126a2cedef5b6e1c1f701ade17c > a3da9a39ec/ext/pgsql/pgsql.c#L5406-L5409 > > > I like this approach in the abstract (though I haven't paged in the > entire problem space yet). A proxy wrapper provides (possibily > implemeted on the SplFileObject itself) keeps the scope of the change > localized to SPL and has little residual hack smell. > > -Sara > --001a114753a257975d055aca632a--