Re: instanceof survives non-object variables, but crashes on non-object constants.

From: Date: Sun, 10 Dec 2017 11:05:23 +0000
Subject: Re: instanceof survives non-object variables, but crashes on non-object constants.
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-101289@lists.php.net to get a copy of this message
> > This. There's nothing undefinable about "1 instanceof \stdClass", the > clear and obvious answer is: "No, it's not an instance of \stdClass, > it's an integer." The runtime result of false makes sense, the > compile time error doesn't. Let's relax the compile time error (fold > it into a const false if you truly must) and call it done. There's no > need to be hostile to users just because the code *seems* silly. > This code doesn't just *seem* silly. For everything but testing whether it works it is totally useless. But we might turn the fatal error into a warning like we do it for "use" in the global namespace: https://3v4l.org/ph7KW Regards, Niklas

« previous php.internals (#101289) next »