Edit report at https://bugs.php.net/bug.php?id=80018&edit=1
ID: 80018
Updated by: [email protected]
Reported by: jamieliu at google dot com
Summary: Tests expect var_dump(FLOAT) to print an integer
Status: Open
Type: Bug
Package: Testing related
Operating System: All
PHP Version: master-Git-2020-08-25 (Git)
Block user comment: N
Private report: N
New Comment:
I agree that this should be fixed, but to my knowledge
run-tests.php does not support %E, but only %f. Are you using
another test runner?
Previous Comments:
------------------------------------------------------------------------
[2020-08-25 20:09:25] jamieliu at google dot com
Description:
------------
Many tests parse the result of var_dump() on a float and expect the result to be an integer:
$ find . -name '*.phpt' | xargs grep 'float(%d)'
./Zend/tests/cast_to_double.phpt:float(%d)
./Zend/tests/settype_double.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_basic.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_basic.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_basic.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk.phpt:float(%d)
./ext/standard/tests/file/disk.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_error.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_error.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_error.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_basic.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_basic.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_basic.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_basic.phpt:float(%d)
./ext/standard/tests/file/disk_free_space_basic.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/file/disk_total_space_variation.phpt:float(%d)
./ext/standard/tests/general_functions/type.phpt:float(%d)
./ext/standard/tests/general_functions/type.phpt:float(%d)
./ext/standard/tests/general_functions/type.phpt:float(%d)
./ext/standard/tests/general_functions/gettype_settype_basic.phpt:float(%d)
./ext/standard/tests/general_functions/gettype_settype_basic.phpt:float(%d)
./ext/standard/tests/general_functions/gettype_settype_basic.phpt:float(%d)
./ext/standard/tests/general_functions/gettype_settype_basic.phpt:float(%d)
This is problematic because var_dump() will print sufficiently large numbers in exponential notation. An example in Linux:
$ mkdir tmp
$ sudo mount -t tmpfs -o size=$((1 << 62)) tmpfs tmp
$ ~/src/php-src/sapi/cli/php --version
PHP 8.0.0-dev (cli) (built: Aug 25 2020 12:55:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
$ ~/src/php-src/sapi/cli/php -r 'var_dump(disk_total_space("tmp"));'
float(4.611686018427388E+18)
I think every instance of "float(%d)" in such tests could simply be converted to use "float(%E)" instead.
Test script:
---------------
See description.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80018&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.