cvs: php4 /ext/standard math.c
| From: | jim winstead | Date: | Sun, 10 Mar 2002 23:46:53 +0000 |
| Subject: | cvs: php4 /ext/standard math.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9880@lists.php.net to get a copy of this message | ||
jimw Sun Mar 10 18:46:53 2002 EDT
Modified files:
/php4/ext/standard math.c
Log:
handle numeric strings. this means we're less picky about the argument
types, but the math functions aren't generally that picky.
Index: php4/ext/standard/math.c
diff -u php4/ext/standard/math.c:1.80 php4/ext/standard/math.c:1.81
--- php4/ext/standard/math.c:1.80 Sat Mar 2 12:08:09 2002
+++ php4/ext/standard/math.c Sun Mar 10 18:46:43 2002
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.80 2002/03/02 17:08:09 hholzgra Exp $ */
+/* $Id: math.c,v 1.81 2002/03/10 23:46:43 jimw 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);
+ 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;