svn: /php/php-src/ branches/PHP_5_3/ext/standard/math.c trunk/ext/standard/math.c
| From: | Ilia Alshanetsky | Date: | Fri, 06 Aug 2010 20:04:29 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/ext/standard/math.c trunk/ext/standard/math.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-63224@lists.php.net to get a copy of this message | ||
iliaa Fri, 06 Aug 2010 20:04:29 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=301939
Log:
Another fix for issue indentified in bug #52550
Bug: http://bugs.php.net/52550 (Analyzed) integer undefined
behaviors executed during "make test"
Changed paths:
U php/php-src/branches/PHP_5_3/ext/standard/math.c
U php/php-src/trunk/ext/standard/math.c
Modified: php/php-src/branches/PHP_5_3/ext/standard/math.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/math.c 2010-08-06 19:55:10 UTC (rev 301938)
+++ php/php-src/branches/PHP_5_3/ext/standard/math.c 2010-08-06 20:04:29 UTC (rev 301939)
@@ -690,7 +690,11 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "base must be greater than 0");
RETURN_FALSE;
}
- RETURN_DOUBLE(log(num) / log(base));
+ if (base == 1) {
+ RETURN_DOUBLE(NAN);
+ } else {
+ RETURN_DOUBLE(log(num) / log(base));
+ }
}
/* }}} */
Modified: php/php-src/trunk/ext/standard/math.c
===================================================================
--- php/php-src/trunk/ext/standard/math.c 2010-08-06 19:55:10 UTC (rev 301938)
+++ php/php-src/trunk/ext/standard/math.c 2010-08-06 20:04:29 UTC (rev 301939)
@@ -690,7 +690,11 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "base must be greater than 0");
RETURN_FALSE;
}
- RETURN_DOUBLE(log(num) / log(base));
+ if (base == 1) {
+ RETURN_DOUBLE(NAN);
+ } else {
+ RETURN_DOUBLE(log(num) / log(base));
+ }
}
/* }}} */