Skip to content

Commit d1df211

Browse files
committed
mysqli: raise ValueError for invalid option in mysqli_options() respecting report_mode
1 parent 6a71d4f commit d1df211

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

ext/mysqli/tests/gh20968.phpt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Bug #20968 mysqli_options() with invalid option triggers ValueError
2+
GH-20968 mysqli_options() with invalid option should triggers ValueError
33
--EXTENSIONS--
44
mysqli
55
--CONFLICTS--
@@ -13,15 +13,14 @@ require_once 'skipifconnectfailure.inc';
1313
require_once 'connect.inc';
1414

1515
$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket);
16-
17-
$value = $mysqli->options(10, 'invalid_option');
18-
19-
var_dump($value);
16+
17+
try {
18+
$value = $mysqli->options(10, 'invalid_option');
19+
var_dump($value);
20+
} catch (ValueError $exception) {
21+
echo $exception->getMessage() . "\n";
22+
}
2023

2124
?>
2225
--EXPECTF--
23-
Fatal error: Uncaught ValueError: mysqli::options(): Argument #1 ($option) must be one of predefined options in %s:%d
24-
Stack trace:
25-
#0 %s(%d): mysqli->options(%d, 'invalid_option')
26-
#1 {main}
27-
thrown in %s on line %d
26+
mysqli::options(): Argument #1 ($option) must be one of predefined options

0 commit comments

Comments
 (0)