note 117552 added to function.is-numeric

From: Date: Fri, 26 Jun 2015 23:17:14 +0000
Subject: note 117552 added to function.is-numeric
Groups: php.notes 
Request: Send a blank email to php-notes+get-202981@lists.php.net to get a copy of this message
Be careful when using is_numeric() to validate user input and protect against SQL injection. According to wiki.hashphp.org, "Many people reach for is_numeric() thinking this is a good approach, and it will seem to work just fine. However the problem with is_numeric() isn't that it can't detect an integer, it is that it detects a lot more than just integers. All of the following are valid numbers to is_numeric(): - 1 - 1.123 - 0xFF - +0123.45e6 See the problem? If we really want just an integer, this function is too broad." Source: http://wiki.hashphp.org/Validation#Why_is_numeric.28.29_is_bad ---- Server IP: 72.52.91.14 Probable Submitter: 2602:306:bd13:5660:3827:a10f:deca:65ed ---- Manual Page -- http://php.net/manual/en/function.is-numeric.php Edit -- https://master.php.net/note/edit/117552 Del: integrated -- https://master.php.net/note/delete/117552/integrated Del: useless -- https://master.php.net/note/delete/117552/useless Del: bad code -- https://master.php.net/note/delete/117552/bad+code Del: spam -- https://master.php.net/note/delete/117552/spam Del: non-english -- https://master.php.net/note/delete/117552/non-english Del: in docs -- https://master.php.net/note/delete/117552/in+docs Del: other reasons-- https://master.php.net/note/delete/117552 Reject -- https://master.php.net/note/reject/117552 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202981) next »