Skip to content

Commit 394470c

Browse files
committed
php_pgsql_meta_data raises a ValueError when table name is invalid.
1 parent 0ce755b commit 394470c

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

ext/pgsql/pgsql.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -4137,9 +4137,8 @@ PHP_PGSQL_API zend_result php_pgsql_meta_data(PGconn *pg_link, const zend_string
41374137
src = estrdup(ZSTR_VAL(table_name));
41384138
tmp_name = php_strtok_r(src, ".", &tmp_name2);
41394139
if (!tmp_name) {
4140-
// TODO ValueError (empty table name)?
41414140
efree(src);
4142-
php_error_docref(NULL, E_WARNING, "The table name must be specified");
4141+
zend_argument_value_error(2, "The table name must be specified (%s)", ZSTR_VAL(table_name));
41434142
return FAILURE;
41444143
}
41454144
if (!tmp_name2 || !*tmp_name2) {

ext/pgsql/tests/pg_insert_002.phpt

+2-5
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ Done
2323
--EXPECTF--
2424
pg_insert(): Argument #2 ($table_name) cannot be empty
2525

26-
Warning: pg_insert(): The table name must be specified in %s on line %d
27-
bool(false)
28-
29-
Warning: pg_insert(): The table name must be specified in %s on line %d
30-
bool(false)
26+
pg_insert(): The table name must be specified (.)
27+
pg_insert(): The table name must be specified (..)
3128
Done

0 commit comments

Comments
 (0)