Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ PHP NEWS
. Improved performance of integer to string conversion, used by string casts,
echo, implode(), json_encode(), serialize() and other places, by emitting
two digits per step. (Alexander Danilov)
. Updated dtoa.c to the latest version, improving float conversion
performance. (Alexander Danilov)
. Fixed bug GH-25788 (clone() with properties corrupts memory with JIT when
__clone() keeps a reference and the result is discarded). (Tomasz Kowalczyk)

Expand Down
6 changes: 6 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ PHP 8.7 UPGRADE NOTES
- Core:
. Block declaration support for the encoding declare has been removed as it
did not function properly.
. Float to string conversion no longer leaves a trailing zero when rounding
an exact tie down: sprintf('%.3G', 370500.0) now returns "3.7E+5".

- Curl:
. curl_multi_exec() now throws a TypeError when $still_running cannot be
Expand Down Expand Up @@ -233,6 +235,10 @@ PHP 8.7 UPGRADE NOTES
traversed the whole graph again after every 10000 possible roots.
. Improved performance of integer to string conversion (string casts, echo,
implode(), json_encode(), serialize(), var_export() and others).
. Improved performance of float to string conversion (string casts,
sprintf(), number_format(), json_encode(), serialize(), var_export() and
others) and of converting long numeric strings to float ((float) casts,
json_decode(), unserialize() and others).

- DOM:
. Parsing HTML with Dom\HTMLDocument or innerHTML uses much less memory for
Expand Down
23 changes: 23 additions & 0 deletions Zend/tests/float_to_string_tie_trailing_zeros.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
No trailing zeros are left when an exact tie is rounded down during float to string conversion
--INI--
precision=14
serialize_precision=10
--FILE--
<?php

var_dump(sprintf('%.3G', 370500.0));
var_dump(sprintf('%.9g', -81320560005.0));
var_dump((string) 183037915746105.0);
var_dump(var_export(81320560005.0, true));
var_dump(json_encode(81320560005.0));
var_dump(serialize(81320560005.0));

?>
--EXPECT--
string(6) "3.7E+5"
string(13) "-8.132056e+10"
string(18) "1.830379157461E+14"
string(12) "8.132056E+10"
string(12) "8.132056e+10"
string(15) "d:8.132056E+10;"
Loading