Skip to content

PHP 8.1 fix in DataFormatter.php for "Implicit conversion from float-INF to int loses precision"#498

Merged
barryvdh merged 1 commit intophp-debugbar:masterfrom
beat:patch-1
Feb 11, 2022
Merged

PHP 8.1 fix in DataFormatter.php for "Implicit conversion from float-INF to int loses precision"#498
barryvdh merged 1 commit intophp-debugbar:masterfrom
beat:patch-1

Conversation

@beat
Copy link
Copy Markdown
Contributor

@beat beat commented Jan 21, 2022

This fixes a PHP 8.1 bug "Deprecated: Implicit conversion from float -INF to int loses precision in vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DataFormatter.php

…-INF to int loses precision"

This fixes a PHP 8.1 bug "Deprecated: Implicit conversion from float -INF to int loses precision in vendor/maximebf/debugbar/src/DebugBar/DataFormatter/DataFormatter.php
@beat
Copy link
Copy Markdown
Contributor Author

beat commented Feb 11, 2022

Any chance this might get merged this week ? This fix is a no-brainer and compatible from PHP 5 through 8.1.
In PHP, arrays indices can only be text or int type, and by default are int type: Floats are not allowed as keys, before they were auto-converted to ints, but in PHP 8.1 they throw a conversion warning if the float is an rounded integer:
See https://www.php.net/manual/en/language.types.array.php :

Note:
Keys that are neither integers nor strings throw a TypeError. Such keys can only be generated by a Traversable object.

We plan to release Joomla 4.1 on Feb 15th and would love to have PHP 8.1 compatibility also in the debugbar by then, would it be possible to review and merge this simple fix, so that composer takes it up, @maximebf ? Merci beaucoup d'avance! :-)

@barryvdh barryvdh merged commit 70e8062 into php-debugbar:master Feb 11, 2022
@beat
Copy link
Copy Markdown
Contributor Author

beat commented Feb 11, 2022

Merci beaucoup @maximebf ! :-) When do you plan the next release with push to packagist ? ;-)

@laoneo
Copy link
Copy Markdown

laoneo commented Mar 20, 2022

@maximebf is there any plan to ship a new release with the PHP 8.1 fixes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants