|  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
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');


Expected result:
both should return -1

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-24 09:33 UTC]
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-2023 The PHP Group
All rights reserved.
Last updated: Sun Feb 05 17:04:43 2023 UTC