converting some doubles to strings yields trailing colon

Bug #218891 reported by Brett Kiefer
6
Affects Status Importance Assigned to Milestone
php
Invalid
Undecided
Unassigned
php5 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: php5

1) Description: Ubuntu hardy (development branch), Release: 8.04

2) module php5, Version: 5.2.4-2ubuntu5

3) I expect any number, divided by 10 times itself, then converted to a string, to yield "0.1"

4) In this release, sometimes I get "0.0:" (yes, that's 0.0 with a trailing colon character)

Detailed repro steps:

I can reproduce this bug on 32-bit Hardy Heron's default PHP, running on VMWare, and have seen it on another user's non-VM setup.

Repro instructions:

$ php -v
PHP 5.2.4-2ubuntu5 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 27 2008 20:43:54)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

$ cat test.php
<?php
        for ($d = 0.10; $d < 1; $d = $d + 0.1) print $d * 10 . " " . ($d / ($d * 10)) . "\n";
?>
1) Description: Ubuntu hardy (development branch), Release: 8.04

2) module php5, Version: 5.2.4-2ubuntu5

$ php test.php
1 0.1
2 0.1
3 0.1
4 0.1
5 0.1
6 0.0:
7 0.0:
8 0.1
9 0.0:
10 0.1

Observed: Iterations 6, 7, and 9 have the output "0.0:"
Expected: All of these should have the output "0.1"

Revision history for this message
Russell Smith (mr-russ) wrote :

This bug does not present itself on my amd64 installation, but it is present on my i386 installation.

Changed in php5:
status: New → Confirmed
Revision history for this message
Russell Smith (mr-russ) wrote :

I have tested this bug against PHP's snapshot php5.2-200805020830. I can reproduce it on i386 using the version listed in this comment. I have logged a bug with PHP.

http://bugs.php.net/bug.php?id=44890

I have not attached the bug URL to the upstream bug as I do now know how to do it for php bugs.

I'll continue to follow this up with PHP developers we can get a resolution upstream. After that we can get the patch merged into Ubuntu.

Thanks again for you bug report.

Russell Smith (mr-russ)
Changed in php:
status: New → Confirmed
Revision history for this message
Russell Smith (mr-russ) wrote :

The bug doesn't actually apply to PHP the package, it only appears to apply as when you compile the php source on Ubuntu the problem appears. Compiling on a different system, in my case CentOS 5.1 i686, give the correct output and the bug is not reproducible.

Changed in php:
status: Confirmed → Invalid
Revision history for this message
Chuck Short (zulcss) wrote :

This should be fixed in lucid now as well.

Regards
chuck

Changed in php5 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.