note 126884 added to migration80.incompatible

From: Date: Fri, 25 Feb 2022 23:57:36 +0000
Subject: note 126884 added to migration80.incompatible
Groups: php.notes 
Request: Send a blank email to php-notes+get-217662@lists.php.net to get a copy of this message
The change in string to int comparison mentioned above (e.g. '' == 0 now equates to false) has some other nasty consequences: $a = ''; // php 8 if ( $a < 0 ) echo 'true'; // echos true if ( $a < -1) echo 'true'; // echos true if ( $a < -100 ) echo 'true'; // echos true // php 7 if ( $a < 0 ) echo 'true'; // no output if ( $a < -1) echo 'true'; // no output if ( $a < -100 ) echo 'true'; // no output So in a situation where you may have a web form input and expected an empty value to equate to 0, watch out not only for == 0, != 0, and <= 0 comparisons, but ALL < or <= comparisons to negative integers. ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.135 (proxied: 74.138.9.61) ---- Manual Page -- https://php.net/manual/en/migration80.incompatible.php Edit -- https://main.php.net/note/edit/126884 Del: integrated -- https://main.php.net/note/delete/126884/integrated Del: useless -- https://main.php.net/note/delete/126884/useless Del: bad code -- https://main.php.net/note/delete/126884/bad+code Del: spam -- https://main.php.net/note/delete/126884/spam Del: non-english -- https://main.php.net/note/delete/126884/non-english Del: in docs -- https://main.php.net/note/delete/126884/in+docs Del: other reasons-- https://main.php.net/note/delete/126884 Reject -- https://main.php.net/note/reject/126884 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#217662) next »