Re: [Discussion] is_string(), string type and objects implementing __toString()

From: Date: Thu, 09 Mar 2017 02:18:27 +0000
Subject: Re: [Discussion] is_string(), string type and objects implementing __toString()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-98450@lists.php.net to get a copy of this message
Hi! > I submitted a GitHub PR* to allow objects implementing __toString() to > *optionally* pass is_string() validation. More verbose wording of my > motivation can be seen in the PR description, but here are the main > points: I don't think it's right approach. is_* functions check the current type of the value, not whether it can be converted to another type. If we need ones that express the latter, we should have different functions. Also, as already noted, having __toString doesn't mean it returns something useful. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#98450) next »