Skip to content

Commit a9e57d8

Browse files
committed
Fix test 'Bug #45373' (#44)
1 parent e364c25 commit a9e57d8

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

tests/bug45373.phpt

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,28 @@ Bug #45373 (php crash on query with errors in params)
55
include("skipif.inc");
66
// See GitHub issue 44
77
// https://github.com/FirebirdSQL/php-firebird/issues/44
8-
include("skipif-php8-or-newer.inc");
98
?>
109
--FILE--
1110
<?php
1211

13-
require("interbase.inc");
12+
require("interbase.inc");
1413

15-
$db = ibase_connect($test_base);
14+
$db = ibase_connect($test_base);
1615

16+
$q = ibase_prepare($db, "SELECT * FROM TEST1 WHERE I = ? AND C = ?");
17+
$r = ibase_execute($q, 1, 'test table not created with isql');
18+
var_dump(ibase_fetch_assoc($r));
19+
ibase_free_result($r);
1720

18-
$sql = "select * from test1 where i = ? and c = ?";
21+
// MUST run with error_reporting & E_NOTICE to generate Notice:
22+
$r = ibase_execute($q, 1, 'test table not created with isql', 1);
23+
var_dump(ibase_fetch_assoc($r));
24+
ibase_free_result($r);
1925

20-
$q = ibase_prepare($db, $sql);
21-
$r = ibase_execute($q, 1, 'test table not created with isql');
22-
var_dump(ibase_fetch_assoc($r));
23-
ibase_free_result($r);
24-
25-
$r = ibase_execute($q, 1, 'test table not created with isql', 1);
26-
var_dump(ibase_fetch_assoc($r));
27-
ibase_free_result($r);
28-
29-
$r = ibase_execute($q, 1);
30-
var_dump(ibase_fetch_assoc($r));
26+
// Enforcing function parameters became more stricter in latest versions of PHP
27+
if($r = ibase_execute($q, 1)) {
28+
var_dump(ibase_fetch_assoc($r));
29+
}
3130

3231
?>
3332
--EXPECTF--
@@ -47,6 +46,3 @@ array(2) {
4746
}
4847

4948
Warning: ibase_execute(): Statement expects 2 arguments, 1 given in %s on line %d
50-
51-
Warning: ibase_fetch_assoc() expects parameter 1 to be resource, bool given in %s on line %d
52-
NULL

tests/skipif-php8-or-newer.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2+
23
if (PHP_MAJOR_VERSION >= 8) {
34
die('skip: This test verifies behavior that can only be observed in PHP versions < 8.0');
45
}
5-
?>

0 commit comments

Comments
 (0)