cvs: php4(PHP_4_2_0) /ext/standard math.c
| From: | Edin Kadribasic | Date: | Thu, 23 May 2002 14:38:09 +0000 |
| Subject: | cvs: php4(PHP_4_2_0) /ext/standard math.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12062@lists.php.net to get a copy of this message | ||
edink Thu May 23 10:38:09 2002 EDT
Modified files: (Branch: PHP_4_2_0)
/php4/ext/standard math.c
Log:
MFH (patch for allowing strings in pow() args, fixes #17374)
Index: php4/ext/standard/math.c
diff -u php4/ext/standard/math.c:1.80.2.1 php4/ext/standard/math.c:1.80.2.2
--- php4/ext/standard/math.c:1.80.2.1 Mon Apr 1 04:21:29 2002
+++ php4/ext/standard/math.c Thu May 23 10:38:08 2002
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.80.2.1 2002/04/01 09:21:29 derick Exp $ */
+/* $Id: math.c,v 1.80.2.2 2002/05/23 14:38:08 edink Exp $ */
#include "php.h"
#include "php_math.h"
@@ -429,14 +429,11 @@
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;