From c614dd677c99e14ac6afb25d7bfe02cfa8cf1981 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 19 Sep 2018 11:31:42 +0200 Subject: [PATCH] Fix intermittent failures in mysqli_stmt_bind_result_format.phpt There were two distinct issues here: * $trend was compared against 'NULL' using !=, which does not work as intended in the case where $trend==0.0. * current_targets was declared as double(17,0), which means that the fractional part was rounded, so that the same comparison in SQL (rounded) and in PHP (not rounded) did not necessarily match. Please don't write mt_rand based tests, it takes ages to debug this crap... --- ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt index dee5a7e0f0..8a1e9b16c0 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt @@ -208,11 +208,11 @@ memory_limit=83886080 if (mysqli_query($link, "CREATE TABLE `test` ( `targetport` int(11) NOT NULL default '0', `sources` double(17,4) default NULL, - `current_sources` double(17,0) default NULL, + `current_sources` double(17,4) default NULL, `reports` double(17,4) default NULL, - `current_reports` double(17,0) default NULL, + `current_reports` double(17,4) default NULL, `targets` double(17,4) default NULL, - `current_targets` double(17,0) default NULL, + `current_targets` double(17,4) default NULL, `maxsources` int(11) default NULL, `maxtargets` int(11) default NULL, `maxreports` int(11) default NULL, @@ -237,7 +237,7 @@ memory_limit=83886080 printf("[301] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); break 2; } - if ($current_targets > 0 && $trend != 'NULL') + if ($current_targets > 0 && $trend !== 'NULL') $values[$trend] = $i; } krsort($values); -- 2.40.0