Skip to content

Commit c251952

Browse files
committed
ext/mysqli: Remove bool type coercions in tests
1 parent 8acff1b commit c251952

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
2020
require_once 'connect.inc';
2121
require_once 'table.inc';
2222

23-
function try_control_string($link, $control_string, $trace_file, $offset) {
23+
function try_control_string($link, $control_string, $trace_file, $offset): string {
2424

2525
@unlink($trace_file);
2626
if (true !== ($tmp = @mysqli_debug($control_string))) {
@@ -29,7 +29,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
2929
$control_string,
3030
gettype($tmp),
3131
$tmp);
32-
return false;
32+
return '';
3333
}
3434

3535
if (!$res = mysqli_query($link, 'SELECT * FROM test')) {
@@ -38,7 +38,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
3838
$control_string,
3939
mysqli_errno($link),
4040
mysqli_error($link));
41-
return false;
41+
return '';
4242
}
4343
while (mysqli_fetch_assoc($res))
4444
;
@@ -51,7 +51,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
5151
$control_string,
5252
gettype($tmp),
5353
$tmp);
54-
return false;
54+
return '';
5555
}
5656

5757
return trim(substr(file_get_contents($trace_file), 0, 100024));

ext/mysqli/tests/mysqli_prepare_no_object.phpt

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,20 @@ require_once 'skipifconnectfailure.inc';
88
?>
99
--FILE--
1010
<?php
11-
require 'table.inc';
11+
require 'table.inc';
12+
if (false !== ($tmp = mysqli_prepare($link, '')))
13+
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true));
14+
printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
1215

13-
if (false !== ($tmp = mysqli_prepare($link, false)))
14-
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true));
15-
printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
16+
mysqli_close($link);
1617

17-
if (false !== ($tmp = mysqli_prepare($link, '')))
18-
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true));
19-
printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
18+
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
2019

21-
mysqli_close($link);
20+
if (false !== ($tmp = $mysqli->prepare('')))
21+
printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true));
22+
printf("b) [%d] %s\n", $mysqli->errno, $mysqli->error);
2223

23-
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
24-
25-
if (false !== ($tmp = $mysqli->prepare(false)))
26-
printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true));
27-
printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
28-
29-
if (false !== ($tmp = $mysqli->prepare('')))
30-
printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), var_export($tmp, true));
31-
printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
32-
33-
print "done!";
24+
print "done!";
3425
?>
3526
--CLEAN--
3627
<?php
@@ -39,6 +30,4 @@ require_once 'clean_table.inc';
3930
--EXPECT--
4031
a) [1065] Query was empty
4132
b) [1065] Query was empty
42-
c) [1065] Query was empty
43-
c) [1065] Query was empty
4433
done!

0 commit comments

Comments
 (0)