Re: make casts more strict in PHP 7

From: Date: Wed, 10 Sep 2014 19:36:55 +0000
Subject: Re: make casts more strict in PHP 7
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-77140@lists.php.net to get a copy of this message
Michael Wallner wrote (on 10/09/2014):
.oO(ext/filter) ?
Maybe I'm just missing some better documentation, but my main problems with ext/filter are: 1) Many users don't know it exists, or how to use it. 2) It's pretty verbose and complex for such a simple task as "is this thing a valid integer?" Basically, it's a swiss army knife, but people are looking for a pair of scissors. There's a lot of code out there doing things like this: if ( is_numeric($_GET['user_id']) ) {
    display_user($_GET['user_id']);
} This is definitely the wrong function to use (what kind of a user ID is '-1.5e-50'?) but it *looks* like the right function, and it has a really simple name, so people don't bother looking for anything more complicated... -- Rowan Collins [IMSoP]

« previous php.internals (#77140) next »