Skip to content

Commit

Permalink
handle numeric strings. this means we're less picky about the argument
Browse files Browse the repository at this point in the history
types, but the math functions aren't generally that picky.
  • Loading branch information
jimwins committed Mar 10, 2002
1 parent 949e6db commit 8544cc1
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions ext/standard/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,11 @@ PHP_FUNCTION(pow)
return;
}

/* TODO: handle numeric strings. */
if ((Z_TYPE_P(zbase) != IS_LONG && Z_TYPE_P(zbase) != IS_DOUBLE) ||
(Z_TYPE_P(zexp ) != IS_LONG && Z_TYPE_P(zexp ) != IS_DOUBLE)) {
php_error(E_WARNING, "Invalid argument(s) passed to %s()", get_active_function_name(TSRMLS_C));
RETURN_FALSE;
}
/* make sure we're dealing with numbers */
convert_scalar_to_number(zbase);
convert_scalar_to_number(zexp);

/* if both base and exponent were longs, try to get a long out */
/* if both base and exponent were longs, we'll try to get a long out */
wantlong = Z_TYPE_P(zbase) == IS_LONG
&& Z_TYPE_P(zexp ) == IS_LONG && Z_LVAL_P(zexp) >= 0;

Expand Down

0 comments on commit 8544cc1

Please sign in to comment.