|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-03-26 11:30 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
[2016-03-26 11:30 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 08:00:01 2025 UTC |
Description: ------------ Prior to PHP 5.6, you could pass a non-numeric string to `gmp_init()` and it would simply return false, allowing you to handle any bad input errors yourself with a boolean check. Since the changes to GMP in PHP 5.6, `gmp_init()` will throw an uncatchable warning: "Unable to convert variable to GMP - string is not an integer". Now, when writing libraries that use GMP, the library has to duplicate the internal validations to avoid throwing an error. This would be ok if there was some sort of public API for the GMP validation, but there isn't. Test script: --------------- $gmp = gmp_init('doge'); // Throws warning on 5.6 Expected result: ---------------- $gmp = gmp_init('doge'); var_dump($gmp); // yields "bool(false)" Actual result: -------------- $gmp = gmp_init('doge'); // Throws warning var_dump($gmp); // yields "bool(false)"