php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch fix-stats_stat_powersum-zero-check for stats Bug #68295

Patch version 2014-10-25 16:52 UTC

Return to Bug #68295 | Download this patch
Patch Revisions:

Developer: php@mcq8.be

Index: php_stats.c
===================================================================
--- php_stats.c	(revision 335134)
+++ php_stats.c	(working copy)
@@ -3082,7 +3082,7 @@
 	zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(arg1), &pos);
 	while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(arg1), (void **)&data, &pos) == SUCCESS) {
 		convert_to_double_ex(data);
-		if (Z_DVAL_PP(data) != 0 && power != 0) {
+		if (Z_DVAL_PP(data) != 0 || power != 0) {
 			sum += pow (Z_DVAL_PP(data), power);
 		} else {
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Both value and power are zero");
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 20:01:45 2024 UTC