]> granicus.if.org Git - php/commitdiff
Promote Warnings to Error in PostgreSQL PDO driver
authorGeorge Peter Banyard <girgias@php.net>
Sat, 12 Sep 2020 21:24:30 +0000 (23:24 +0200)
committerGeorge Peter Banyard <girgias@php.net>
Mon, 14 Sep 2020 11:41:10 +0000 (13:41 +0200)
Closes GH-6119

ext/pdo_pgsql/pgsql_driver.c

index 38ea304a30e9bc0f8b7cab406dd0354cd51c2cd6..2666ae66e146fd5199574de92520b81ed7551a9b 100644 (file)
@@ -566,8 +566,8 @@ PHP_METHOD(PDO_PGSql_Ext, pgsqlCopyFromArray)
        }
 
        if (!zend_hash_num_elements(Z_ARRVAL_P(pg_rows))) {
-               php_error_docref(NULL, E_WARNING, "Cannot copy from an empty array");
-               RETURN_FALSE;
+               zend_argument_value_error(2, "cannot be empty");
+               RETURN_THROWS();
        }
 
        dbh = Z_PDO_DBH_P(ZEND_THIS);
@@ -1061,13 +1061,13 @@ PHP_METHOD(PDO_PGSql_Ext, pgsqlGetNotify)
        }
 
        if (result_type != PDO_FETCH_BOTH && result_type != PDO_FETCH_ASSOC && result_type != PDO_FETCH_NUM) {
-               php_error_docref(NULL, E_WARNING, "Invalid result type");
-               RETURN_FALSE;
+               zend_argument_value_error(1, "must be one of PDO::FETCH_BOTH, PDO::FETCH_ASSOC, or PDO::FETCH_NUM");
+               RETURN_THROWS();
        }
 
        if (ms_timeout < 0) {
-               php_error_docref(NULL, E_WARNING, "Invalid timeout");
-               RETURN_FALSE;
+               zend_argument_value_error(2, "must be greater than or equal to 0");
+               RETURN_THROWS();
 #ifdef ZEND_ENABLE_ZVAL_LONG64
        } else if (ms_timeout > INT_MAX) {
                php_error_docref(NULL, E_WARNING, "Timeout was shrunk to %d", INT_MAX);