Re: Regarding object casting

From: Date: Mon, 02 Dec 2013 16:07:10 +0000
Subject: Re: Regarding object casting
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-70470@lists.php.net to get a copy of this message
Hi Matīss,

Internal classes are able to define what happens when casting to different
primitive types. There was an RFC [1] to extend this behavior to userland,
but it has since been withdrawn. See archives for further discussion about
this.

Best regards,
--Matthew


On Mon, Dec 2, 2013 at 4:19 AM, Matīss 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 are
> exploiting the SimpleXML to achieve the ability to control object casting..
>
> 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.
>


Thread (3 messages)

« previous php.internals (#70470) next »