Re: [RFC] Safe Casting Functions

From: Date: Wed, 19 Nov 2014 19:04:08 +0000
Subject: Re: [RFC] Safe Casting Functions
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-79008@lists.php.net to get a copy of this message
On Wed, November 19, 2014 19:47, Andrea Faulds wrote: >>> __toString() always errors if it doesn’t return a string, I see no >>> reason to change that. >> But in the other cases it converts strings to numbers. I mean like >> class A {function __toString(){return '10';}} $a = (string) (new A); >> //numeric literal >> > > ? > > > I see no numbers? > Yeah, try_string(new A) == (string)(new A), but try_int(new A) != (int)(string)(new A) in the RFC. Whereby '10' were pretty valid for int, no? Regards Anatol

« previous php.internals (#79008) next »