Skip to content

Commit e509da1

Browse files
committed
empty stmt name for pg_close_stmt using helper and testing it.
1 parent e8ab696 commit e509da1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ext/pgsql/pgsql.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6329,7 +6329,7 @@ PHP_FUNCTION(pg_close_stmt)
63296329
ZEND_PARSE_PARAMETERS_END();
63306330

63316331
if (ZSTR_LEN(stmt) == 0) {
6332-
zend_argument_value_error(2, "cannot be empty");
6332+
zend_argument_must_not_be_empty_error(2);
63336333
RETURN_THROWS();
63346334
}
63356335

ext/pgsql/tests/pg_close_stmt.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ $db = pg_connect($conn_str);
1818
$res = pg_prepare($db, 'test', $query);
1919

2020
$res = pg_execute($db, 'test', $params_null);
21+
try {
22+
pg_close_stmt($db, '');
23+
} catch (\ValueError $e) {
24+
echo $e->getMessage(), PHP_EOL;
25+
}
2126
$res = pg_close_stmt($db, 'test');
2227
var_dump($res !== false);
2328
var_dump(pg_result_status($res) === PGSQL_COMMAND_OK);
@@ -29,5 +34,6 @@ pg_close($db);
2934

3035
?>
3136
--EXPECT--
37+
pg_close_stmt(): Argument #1 ($stmt) must not be empty
3238
bool(true)
3339
bool(true)

0 commit comments

Comments
 (0)