php gives "0.0:" as value for 0.6/6

Bug #372091 reported by morodoch
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Fix Released
Medium
Unassigned
Declined for Hardy by Mathias Gug

Bug Description

Binary package hint: php5

lsb_release -rd
Description: Ubuntu 8.04.2
Release: 8.04

apt-cache policy php5-cli
php5-cli:
  Installed: 5.2.4-2ubuntu5.6
  Candidate: 5.2.4-2ubuntu5.6
  Version table:
 *** 5.2.4-2ubuntu5.6 0
        500 http://gb.archive.ubuntu.com hardy-updates/main Packages
        500 http://security.ubuntu.com hardy-security/main Packages
        100 /var/lib/dpkg/status
     5.2.4-2ubuntu5 0
        500 http://gb.archive.ubuntu.com hardy/main Packages

apt-cache policy php5
php5:
  Installed: (none)
  Candidate: 5.2.4-2ubuntu5.6
  Version table:
     5.2.4-2ubuntu5.6 0
        500 http://gb.archive.ubuntu.com hardy-updates/main Packages
        500 http://security.ubuntu.com hardy-security/main Packages
     5.2.4-2ubuntu5 0
        500 http://gb.archive.ubuntu.com hardy/main Packages

Running this code:

<?php

bcscale(10);

error_log(0.5/5);
error_log(0.6/6);
error_log(bcdiv(0.6, 6));
?>

Produces this output:

0.1
0.0:
0.1000000000

I'd expect the second line to be "0.1", not "0.0:". The bcdiv value is correct.

Revision history for this message
Daniel Hahler (blueyed) wrote :

Cannot confirm this on Karmic.

Are you using a 64bit arch? (I'm not)

$ php -r "echo PHP_VERSION; echo PHP_EOL; echo 0.6/6; echo PHP_EOL;"
5.2.6-3ubuntu4.1
0.1

Changed in php5 (Ubuntu):
status: New → Incomplete
Revision history for this message
Jonathan Marsden (jmarsden) wrote :

@Daniel: I get the same results as you ( 0.1 ) on Ubuntu Jaunty 9.04 amd64. I also tested morodoch's PHP example code, and it works fine here also:

$ php -r "echo PHP_VERSION; echo PHP_EOL; echo 0.6/6; echo PHP_EOL;"
5.2.6-3ubuntu4.1
0.1
$ echo -e "<?php\nbcscale(10);\nerror_log(0.5/5);\nerror_log(0.6/6);\nerror_log(bcdiv(0.6, 6));\n?>" |php
0.1
0.1
0.1000000000
$

So if this is reproducible, maybe it is only reproducible under Ubuntu Hardy 8.04 ??

Revision history for this message
Daniel Hahler (blueyed) wrote :

Confirmed on Hardy (in an OpenVZ container).

# php -r "echo PHP_VERSION; echo PHP_EOL; echo 0.6/6; echo PHP_EOL;"
5.2.4-2ubuntu5.6
0.0:

Upgrading to a backport therein makes it work again:
# php -r "echo PHP_VERSION; echo PHP_EOL; echo 0.6/6; echo PHP_EOL;"
5.2.9-0ubuntu1~blueyed1
0.1

Downgrading to the released version (from the "hardy" repo) shows the same problem:
# php -r "echo PHP_VERSION; echo PHP_EOL; echo 0.6/6; echo PHP_EOL;"
5.2.4-2ubuntu5
0.0:

Changed in php5 (Ubuntu):
importance: Undecided → Medium
status: Incomplete → Triaged
Revision history for this message
Daniel Hahler (blueyed) wrote :

Fixed in Karmic/Jaunty.

Changed in php5 (Ubuntu):
status: Triaged → 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.