mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-18695: float numbers zero fraction is now preserved in zend_ast_export() (#18699)
This commit is contained in:
4
NEWS
4
NEWS
@@ -2,6 +2,10 @@ PHP NEWS
|
|||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
?? ??? ????, PHP 8.3.23
|
?? ??? ????, PHP 8.3.23
|
||||||
|
|
||||||
|
- Core:
|
||||||
|
. Fixed GH-18695 (zend_ast_export() - float number is not preserved).
|
||||||
|
(Oleg Efimov)
|
||||||
|
|
||||||
- Date:
|
- Date:
|
||||||
. Fix leaks with multiple calls to DatePeriod iterator current(). (nielsdos)
|
. Fix leaks with multiple calls to DatePeriod iterator current(). (nielsdos)
|
||||||
|
|
||||||
|
|||||||
26
Zend/tests/ast/ast_serialize_floats.phpt
Normal file
26
Zend/tests/ast/ast_serialize_floats.phpt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
--TEST--
|
||||||
|
Serialization of floats are correct
|
||||||
|
--INI--
|
||||||
|
zend.assertions=1
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
try {
|
||||||
|
assert(!is_float(0.0));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
assert(!is_float(1.1));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
assert(!is_float(1234.5678));
|
||||||
|
} catch (AssertionError $e) {
|
||||||
|
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
assert(): assert(!is_float(0.0)) failed
|
||||||
|
assert(): assert(!is_float(1.1)) failed
|
||||||
|
assert(): assert(!is_float(1234.5678)) failed
|
||||||
@@ -1563,7 +1563,7 @@ static ZEND_COLD void zend_ast_export_zval(smart_str *str, zval *zv, int priorit
|
|||||||
break;
|
break;
|
||||||
case IS_DOUBLE:
|
case IS_DOUBLE:
|
||||||
smart_str_append_double(
|
smart_str_append_double(
|
||||||
str, Z_DVAL_P(zv), (int) EG(precision), /* zero_fraction */ false);
|
str, Z_DVAL_P(zv), (int) EG(precision), /* zero_fraction */ true);
|
||||||
break;
|
break;
|
||||||
case IS_STRING:
|
case IS_STRING:
|
||||||
smart_str_appendc(str, '\'');
|
smart_str_appendc(str, '\'');
|
||||||
|
|||||||
Reference in New Issue
Block a user