Bug #81150 [Ver]: Deprecated non-integer-compatible float conversions missing from UPGRADING
| From: | call dot user dot func at gmail dot com | Date: | Thu, 17 Jun 2021 05:14:47 +0000 |
| Subject: | Bug #81150 [Ver]: Deprecated non-integer-compatible float conversions missing from UPGRADING | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234443@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
User updated by: call dot user dot func at gmail dot com
Reported by: call dot user dot func at gmail dot com
Summary: Deprecated non-integer-compatible float conversions
missing from UPGRADING
Status: Verified
Type: Bug
Package: *General Issues
Operating System: Windows 10
PHP Version: 8.1.0alpha1
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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