Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70476 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27071 invoked from network); 3 Dec 2013 07:13:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Dec 2013 07:13:36 -0000 Authentication-Results: pb1.pair.com header.from=mrtreinis@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=mrtreinis@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: mrtreinis@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:61300] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/90-23695-E948D925 for ; Tue, 03 Dec 2013 02:13:35 -0500 Received: by mail-wg0-f48.google.com with SMTP id z12so13135270wgg.27 for ; Mon, 02 Dec 2013 23:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jEeUTRjGg5M8V0N1TVgjS4jTyDsCYXALbgSrUYgX2OA=; b=Ba3ig8RMWit0X9I31Wjc4yZHMLSYY4Cmae4lJjEDVo59OfakAQEROJvoaQostJ2gMX H33TF2IXAQJRgcPIhAATOLUoZ5cEbD8dCXOrXyrnqi9USxQ1Hv5MHXqM6gK/ctMaIhtS BRphJpEqfShJvc+XHhAQf5nwB2neHcZwnB0O+a8CNyRRl9FfFn2DVi14hLeAGRP8VXYu sUim6RglVAfPE6A88G4VV+tCBfW37IKs5kRr/vucXFMP1pObf61sL3TgGvNq/y476LY0 4MQ165pGYbUmCJcvDvgiAXbOIRCKenwoEV3y2x8RvBnVMdBJf4yxqdWFKKyaXd4BE/ek tCrA== MIME-Version: 1.0 X-Received: by 10.194.143.100 with SMTP id sd4mr789820wjb.69.1386054811593; Mon, 02 Dec 2013 23:13:31 -0800 (PST) Received: by 10.194.205.197 with HTTP; Mon, 2 Dec 2013 23:13:31 -0800 (PST) In-Reply-To: References: Date: Tue, 3 Dec 2013 09:13:31 +0200 Message-ID: To: Matthew Fonda Cc: PHP Internals Content-Type: multipart/alternative; boundary=089e01161d3eaf349704ec9c0800 Subject: Re: [PHP-DEV] Regarding object casting From: mrtreinis@gmail.com (=?UTF-8?Q?Mat=C4=ABss_Roberts_Treinis?=) --089e01161d3eaf349704ec9c0800 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I have reopened the mentioned RFC ( https://wiki.php.net/rfc/object_cast_to_types) with kind permission of the original author. I would like to discuss fallowing matter, regarding to the mentioned RFC - how would these changes affect comparison? Would it be possible to adapt the changes to allow an object to be truthy and falsy in comparison operations, like it is to the SimpleXML? 2013/12/2 Matthew Fonda > Hi Mat=C4=ABss, > > Internal classes are able to define what happens when casting to differen= t > primitive types. There was an RFC [1] to extend this behavior to userland= , > but it has since been withdrawn. See archives for further discussion abou= t > this. > > Best regards, > --Matthew > > > On Mon, Dec 2, 2013 at 4:19 AM, Mat=C4=ABss Roberts Treinis < > mrtreinis@gmail.com> wrote: > >> Good day, PHP internals folks. >> >> As we all know, objects in PHP casts to true by default, except one >> particular class - SimpleXML objects created from empty tag. >> >> Many people in the community has had a problem with this limitation (or >> lack of functionality) to be able to set cast value of the object and ar= e >> exploiting the SimpleXML to achieve the ability to control object castin= g. >> >> The question would be, why this exception - SimpleXML? Could we have a >> magic method or other way to control how object is being casted? >> >> Thoughts? >> >> Thanks. >> > > --089e01161d3eaf349704ec9c0800--