From f2dac4a25a1654cf24fc11c24c0277aa4f59c8ed Mon Sep 17 00:00:00 2001 From: Edin Kadribasic Date: Thu, 23 May 2002 14:38:08 +0000 Subject: [PATCH] MFH (patch for allowing strings in pow() args, fixes #17374) --- ext/standard/math.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ext/standard/math.c b/ext/standard/math.c index ae9a5b02e2..4ca710d235 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -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 TSRMLS_CC); + convert_scalar_to_number(zexp TSRMLS_CC); - /* 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; -- 2.50.1