Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65508 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10401 invoked from network); 30 Jan 2013 15:54:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jan 2013 15:54:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=dragoonis@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dragoonis@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.50 as permitted sender) X-PHP-List-Original-Sender: dragoonis@gmail.com X-Host-Fingerprint: 209.85.216.50 mail-qa0-f50.google.com Received: from [209.85.216.50] ([209.85.216.50:38222] helo=mail-qa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/13-09318-F4249015 for ; Wed, 30 Jan 2013 10:54:55 -0500 Received: by mail-qa0-f50.google.com with SMTP id dx4so467369qab.9 for ; Wed, 30 Jan 2013 07:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=YtgmZqOK3eHy6dBNbklF1awkun2Npt5tKaZW8xfyNPg=; b=u2YIFj72219ebQ8liiExAz3imPQS9VOK/7M5gpkA5E1/J0Kcrnjq0WSLjQUrC00eNs 3WAohXt8llY4lS3hOyr2NC6fNsHy/JIOEDBUXY+dHn3zFbggY7r15Pb0DN9/HbGltszM P+84N8LIKbNZ5PKrKLLVH/PzDjP6taRBNy0FXmNxOmTACewVUbuNSM0Hf0N1+I0fs3Vv UuaGQ0PUvBTVEp+/lN2t8C0CgRshwLrB2O6CygZ6433g4JAMXwIWZqeIZoetKQQ3o4UW K1QbifeIZHdCqzZ0xrs+rSsJddV1u+S2PsCsdCQfkXVV0Myg9YAYQyUcvNpNr8Xlk4Br puWQ== MIME-Version: 1.0 X-Received: by 10.224.96.4 with SMTP id f4mr5430339qan.79.1359561292673; Wed, 30 Jan 2013 07:54:52 -0800 (PST) Received: by 10.229.126.75 with HTTP; Wed, 30 Jan 2013 07:54:52 -0800 (PST) In-Reply-To: <1359560655.44471.YahooMailNeo@web133004.mail.ir2.yahoo.com> References: <1359498582.20362.YahooMailNeo@web133002.mail.ir2.yahoo.com> <51085497.3090504@sugarcrm.com> <1359560655.44471.YahooMailNeo@web133004.mail.ir2.yahoo.com> Date: Wed, 30 Jan 2013 15:54:52 +0000 Message-ID: To: hakre Cc: Stas Malyshev , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf3074d6a0e673be04d483876f Subject: Re: [PHP-DEV] echo new SplFileObject(__FILE__); From: dragoonis@gmail.com (Paul Dragoonis) --20cf3074d6a0e673be04d483876f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable To be honest, it looks like __toString() was just added in there for the sake of it without any real thought as to what casting an entier SplFileObject to a string. This to me implies the entire object( i.e: the entire file ) should be returned as a string rather than aliasing it to a method because why would you cast something to a string if you can call ->current() anyway. Since it's been baked into the object for some time now it can't even be changed now. I'd try to avoid this casting magic and stick with ->current() if you actually mean it. Thanks, Paul Dragoonis. On Wed, Jan 30, 2013 at 3:44 PM, hakre wrote: > > > ----- Urspr=FCngliche Message ----- > > > Von: Stas Malyshev > > Gesendet: 0:00 Mittwoch, 30.Januar 2013 > > Betreff: Re: [PHP-DEV] echo new SplFileObject(__FILE__); > > > > > > __toString is mapped to current() for SplFileObject: > > http://www.php.net/manual/en/splfileobject.current.php > > > > it's not documented for some reason, I think it makes sense to file a > > docs bug on that. > > Thanks for your answer. > > I know that there is code in there that does this and I also got into the > know that it is not properly documented. > > I just write this to clarify that I'm more interested in the why it has > been coded that way. > > It does not make much *sense* to me and I want to learn more. > > Also I don't mean this explicit technically. I could blame the version > control, pick the authors name and email that person; however some time h= as > passed and more users are using it not only the original author so I ask = in > internals first. Just for clarification. > > -- hakre > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --20cf3074d6a0e673be04d483876f--