php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17744 pow() error
Submitted: 2002-06-13 11:36 UTC Modified: 2002-06-13 11:50 UTC
From: filizzi at umich dot edu Assigned:
Status: Closed Package: Math related
PHP Version: 4.2.1 OS: Linux 2.4.17
Private report: No CVE-ID: None
 [2002-06-13 11:36 UTC] filizzi at umich dot edu
When using the pow() function as follows, where $level_factor and $playerinfo[engines] are 1.5, 0 respectivly. (the value for $playerinfo[engines] can be anywhere from 0 on up and still produce the same result) and $playerinfo[engines] is taken from a mysql database (might happen with other database connections as well).

$shipspeed = pow($level_factor, $playerinfo[engines]);

when the line is entered staticly (see below) it works fine.
$shipspeed = pow(1.5, 0);

These are the errors reported.

Warning: Invalid argument(s) passed to pow() in /usr/local/blacknova/rsmove.php on line 118

Warning: Invalid argument(s) passed to pow() in /usr/local/blacknova/global_funcs.php on line 421

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-13 11:50 UTC] edink@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

As a workaround you can try:

$shipspeed = pow((float)$level_factor, (float)$playerinfo[engines]);

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 20:03:41 2021 UTC