php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49342 gnu_cmp doesn't work with decimal strings
Submitted: 2009-08-24 04:36 UTC Modified: 2009-08-24 09:33 UTC
From: scott at connerly dot net Assigned:
Status: Not a bug Package: GNU MP related
PHP Version: 5.2.10 OS: Linux
Private report: No CVE-ID: None
 [2009-08-24 04:36 UTC] scott at connerly dot net
Description:
------------
gnu_cmp doesn't work with decimal strings



Reproduce code:
---------------
---
From manual page: function.gmp-cmp
---

$integers = gmp_cmp('2','5');
$floats = gmp_cmp('2.5','5');

var_dump($integers,$floats);

Expected result:
----------------
both should return -1

Actual result:
--------------
int(-1)
bool(false)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-24 09:33 UTC] sjoerd@php.net
Thank you for your bug report.

The documentation on GMP says:
These functions allow you to work with arbitrary-length integers using the GNU MP library.

Since 2.5 is not an integer, I don't think your example is supposed to work. Also, I can't find the example on the function.gmp-cmp page, so it also does not seem an error in the documentation.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Sep 20 09:01:26 2019 UTC