Bug #81150 [Ver->Csd]: Deprecated non-integer-compatible float conversions missing from UPGRADING

From: Date: Thu, 17 Jun 2021 07:52:58 +0000
Subject: Bug #81150 [Ver->Csd]: Deprecated non-integer-compatible float conversions missing from UPGRADING
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234447@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81150&edit=1 ID: 81150 Updated by: git@php.net Reported by: call dot user dot func at gmail dot com Summary: Deprecated non-integer-compatible float conversions missing from UPGRADING -Status: Verified +Status: Closed Type: Bug Package: *General Issues Operating System: Windows 10 PHP Version: 8.1.0alpha1 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikic Revision: https://github.com/php/php-src/commit/deb7955bf44cb687419582e0ea58ff259c1952d5 Log: Fix #81150 Add UPGRADING note for float to int deprecation Previous Comments: ------------------------------------------------------------------------ [2021-06-17 05:14:47] call dot user dot func at gmail dot com Thanks for the fast response. I never noticed that floats implicit casted to int in array keys. This affect so many user land code, will be a hell of a job to fix that all. PhpSpreadsheet for example throws millions of those deprecations because it uses raw cellValues as indexes of arrays. But i see this a good change, because many, including me, will not have noticed that php does automaticy float to int cast in array keys. As well i never really noticed that casting float to string will also result in that precision lost. Thanks. ------------------------------------------------------------------------ [2021-06-17 05:06:10] requinix@php.net See https://wiki.php.net/rfc/implicit-float-int-deprecate ------------------------------------------------------------------------ [2021-06-17 04:45:12] call dot user dot func at gmail dot com Description: ------------ Hi. The following code produces a deprecation warning in 8.1 alpha. Is it used to be like this or is it a bug? I can't find such information in the deprecation information of https://github.com/php/php-src/blob/php-8.1.0alpha1/UPGRADING Test script: --------------- $arr = []; $cellValue = 159.6; var_dump(isset($arr[$cellValue])); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81150&edit=1

« previous php.bugs (#234447) next »