Bug #52167 [NEW]: gmp_pow does not accept gmp values

From: Date: Thu, 24 Jun 2010 07:39:20 +0000
Subject: Bug #52167 [NEW]: gmp_pow does not accept gmp values
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151827@lists.php.net to get a copy of this message
From: Operating system: Linux PHP version: 5.3.2 Package: GNU MP related Bug Type: Bug Bug description:gmp_pow does not accept gmp values Description: ------------ gmp_pow throws a "expects parameter 2 to be long" error when passed a gmp value. Works nicely with PHP 5.2.x but not with PHP 5.3. I am doing some maths for encryption with php which use large integers and I have to compute pow(a,b) with both values being large integers (~512 bits). I'm opening this bug so we can investigate why gmp_pow() has been modified to only accept integers as second argument, and if there is no good reason make it accept gmp values again. My guess is this change was done on the PHP_5_2 branch but not ported to PHP_5_3. Unfortunately svn blame couldn't fetch anything interesting to know why this became like this. Test script: --------------- $a=gmp_init(48974); $b=gmp_init(55); $c=gmp_pow($a,$b); var_dump(gmp_intval($c)); Expected result: ---------------- int(7944261659914959072) Actual result: -------------- Warning: gmp_pow() expects parameter 2 to be long, resource given in Command line code on line 1 int(0) -- Edit bug report at http://bugs.php.net/bug.php?id=52167&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52167&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52167&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52167&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52167&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52167&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52167&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52167&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52167&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52167&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52167&r=support Expected behavior: http://bugs.php.net/fix.php?id=52167&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52167&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52167&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52167&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52167&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52167&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52167&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52167&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52167&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52167&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52167&r=mysqlcfg

« previous php.bugs (#151827) next »