php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49392 Many tests try to verify float to integer overflow result
Submitted: 2009-08-27 18:45 UTC Modified: 2013-02-18 00:33 UTC
From: cndougla at linux dot vnet dot ibm dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cndougla at linux dot vnet dot ibm dot com
New email:
PHP Version: OS:

 

 [2009-08-27 18:45 UTC] cndougla at linux dot vnet dot ibm dot com
Description:
------------
Many tests have input values like 10.5e10 that must be converted to integer values. On 32-bit systems, the conversion overflows. According to the PHP manual:

---
If the float is beyond the boundaries of integer (usually +/- 2.15e+9 = 2^31), the result is undefined, since the float doesn't have enough precision to give an exact integer result. No warning, not even a notice will be issued when this happens!
---

Therefore, the tests are attempting to verify undefined values.

Reproduce code:
---------------
We found a bunch of testcases with this issue by running in a ppc64 kernel / ppc32 userspace:

ext/standard/tests/array/array_fill_variation1.phpt
ext/standard/tests/array/array_keys_variation_002.phpt
ext/standard/tests/general_functions/gettype_settype_variation2.phpt
ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt
ext/standard/tests/strings/pack.phpt
ext/standard/tests/strings/sprintf_variation35.phpt
ext/standard/tests/strings/sprintf_variation4.phpt
ext/standard/tests/strings/sprintf_variation41.phpt
ext/standard/tests/strings/strncasecmp_variation5.phpt
ext/standard/tests/strings/strncmp_variation5.phpt
ext/standard/tests/strings/strrpos_variation14.phpt
ext/standard/tests/strings/strrpos_variation15.phpt
ext/standard/tests/strings/vsprintf_variation15.phpt
ext/standard/tests/strings/vsprintf_variation16.phpt
ext/standard/tests/strings/vsprintf_variation4.phpt

We also found the following test had issues on ppc64/ppc64:

ext/standard/tests/strings/vsprintf_variation15_64bit.phpt

Expected result:
----------------
These tests should not be checking for the value of the direct or indirect overflow of a float to integer conversion. The tests should have the one or two subtests that do this removed.

Actual result:
--------------
The tests fail on some platforms, especially split 64/32-bit installations.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 16:00 UTC] jani@php.net
-Status: Open +Status: Feedback -Type: Feature/Change Request +Type: Bug -Package: Feature/Change Request +Package: *General Issues -PHP Version: 6SVN-2009-08-27 (SVN) +PHP Version: *
 [2011-01-01 16:00 UTC] jani@php.net
Can you update the list of failing tests with current PHP_5_3 / trunk ?
 [2013-02-18 00:33 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 14:01:31 2024 UTC