php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18858 conversion problems with pow() ?
Submitted: 2002-08-11 12:04 UTC Modified: 2002-08-11 18:18 UTC
Votes:2
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: raz0 at worldonline dot dk Assigned:
Status: Closed Package: *Math Functions
PHP Version: 4.2.0 OS: Windows 98 SE
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: raz0 at worldonline dot dk
New email:
PHP Version: OS:

 

 [2002-08-11 12:04 UTC] raz0 at worldonline dot dk
I don't know if this is a bug, but it seems that pow()
doesn't convert strings to integers like other functions.

For instance if you have the variable $_GET['size'] and
you try this...

<? pow($_GET['size'], 2); ?>

... pow() will produce an error because $_GET['size'] is
still a string (I tested var_dump($_GET['size']) and it
says it's a string).

Hope this helps in the further development of PHP :)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-11 12:07 UTC] raz0 at worldonline dot dk
Note: you can still cast the string to an integer like this:

<? pow((int)$_GET['size'], 2); ?>
 [2002-08-11 18:18 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.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Aug 13 18:05:44 2022 UTC