Re: PHP 7.1 - Address PHPSadness #28?

From: Date: Fri, 18 Sep 2015 18:38:12 +0000
Subject: Re: PHP 7.1 - Address PHPSadness #28?
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-88351@lists.php.net to get a copy of this message
Benoit Schildknecht wrote on 18/09/2015 19:24:
I agree. exists() would allow PHP devs to make more secure, cleaner and lighter code. It fills a gap and would be useful to a lot of devs.
On the contrary, I think code using exists() would be extremely fragile, because it's highly resistant to refactoring, and encourages developers to leave variables uninitialised. What makes cleaner, more secure code is always initialising your variables before using them - basically, what the "undefined variable" Notice is suggesting you do. The examples Lester and Robert have come up with make sense in themselves, but are not architectures I would choose precisely because they are opaque (you have to remember what unset() and null mean) and hard to extend (there's no way to introduce a 4th state alongside the unset/null/value triad). Obviously, all language features can be used to write bad code, but it seems much easier to write bad code than good using this proposed function. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#88351) next »