php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66657 gmp_init('') throws warning
Submitted: 2014-02-06 15:45 UTC Modified: 2014-02-06 22:07 UTC
From: thomas dot hebinck at digionline dot de Assigned:
Status: Not a bug Package: GNU MP related
PHP Version: 5.6Git-2014-02-06 (snap) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 + 21 = ?
Subscribe to this entry?

 
 [2014-02-06 15:45 UTC] thomas dot hebinck at digionline dot de
Description:
------------
Up to PHP 5.5.9 gmp_init() called with an empty string as argument had the same result as called with a zero. In PHP 5.6 Alpha 1 (and the current snapshot) this call throws a warning. This breaks existing code.

Test script:
---------------
echo gmp_strval(gmp_init(''));

Expected result:
----------------
"0"

Actual result:
--------------
Warning:  gmp_init() [function.gmp-init.php]: Unable to convert variable to GMP - string is not an integer in /SPACE/ww3/www/wws/130009.php(103) : eval()'d code on line 1

"0"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-06 22:07 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2014-02-06 22:07 UTC] nikic@php.net
gmp_init('') did not return a GMP zero, but boolean false, indicating an error condition. PHP 5.6 adds a warning for that previously silent error.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 20:01:27 2019 UTC