note 119891 added to language.types.string

From: Date: Thu, 15 Sep 2016 20:44:51 +0000
Subject: note 119891 added to language.types.string
Groups: php.notes 
Request: Send a blank email to php-notes+get-206596@lists.php.net to get a copy of this message
Beware that consistent with "String conversion to numbers": <?php if ('123abc' == 123) echo '(intstr == int) incorrectly tests as true.'; // Because one side is a number, the string is incorrectly converted from intstr to int, which then matches the test number. // True for all conditionals such as if and switch statements (probably also while loops)! // This could be a huge security risk when testing/using/saving user input, while expecting and testing for only an integer. // It seems the only fix is for 123 to be a string as '123' so no conversion happens. ?> ---- Server IP: 72.52.91.14 Probable Submitter: 97.101.212.164 ---- Manual Page -- http://php.net/manual/en/language.types.string.php Edit -- https://master.php.net/note/edit/119891 Del: integrated -- https://master.php.net/note/delete/119891/integrated Del: useless -- https://master.php.net/note/delete/119891/useless Del: bad code -- https://master.php.net/note/delete/119891/bad+code Del: spam -- https://master.php.net/note/delete/119891/spam Del: non-english -- https://master.php.net/note/delete/119891/non-english Del: in docs -- https://master.php.net/note/delete/119891/in+docs Del: other reasons-- https://master.php.net/note/delete/119891 Reject -- https://master.php.net/note/reject/119891 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206596) next »