Skip to content

Commit c81c997

Browse files
committed
Promote Warnings to Error in PostgreSQL PDO driver
1 parent 67d21bf commit c81c997

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@ PHP_METHOD(PDO_PGSql_Ext, pgsqlCopyFromArray)
566566
}
567567

568568
if (!zend_hash_num_elements(Z_ARRVAL_P(pg_rows))) {
569-
php_error_docref(NULL, E_WARNING, "Cannot copy from an empty array");
570-
RETURN_FALSE;
569+
zend_argument_value_error(2, "cannot be empty");
570+
RETURN_THROWS();
571571
}
572572

573573
dbh = Z_PDO_DBH_P(ZEND_THIS);
@@ -1061,13 +1061,13 @@ PHP_METHOD(PDO_PGSql_Ext, pgsqlGetNotify)
10611061
}
10621062

10631063
if (result_type != PDO_FETCH_BOTH && result_type != PDO_FETCH_ASSOC && result_type != PDO_FETCH_NUM) {
1064-
php_error_docref(NULL, E_WARNING, "Invalid result type");
1065-
RETURN_FALSE;
1064+
zend_argument_value_error(1, "must be one of PDO::FETCH_BOTH, PDO::FETCH_ASSOC, or PDO::FETCH_NUM");
1065+
RETURN_THROWS();
10661066
}
10671067

10681068
if (ms_timeout < 0) {
1069-
php_error_docref(NULL, E_WARNING, "Invalid timeout");
1070-
RETURN_FALSE;
1069+
zend_argument_value_error(2, "must be greater than or equal to 0");
1070+
RETURN_THROWS();
10711071
#ifdef ZEND_ENABLE_ZVAL_LONG64
10721072
} else if (ms_timeout > INT_MAX) {
10731073
php_error_docref(NULL, E_WARNING, "Timeout was shrunk to %d", INT_MAX);

0 commit comments

Comments
 (0)