From: George Peter Banyard Date: Fri, 25 Sep 2020 15:35:50 +0000 (+0100) Subject: Merge branch 'PHP-7.4' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c10d4d9a9aa0a0e3fcaa83d9365b2c3cc1447cb;p=php Merge branch 'PHP-7.4' * PHP-7.4: Fix logic error in PDO --- 3c10d4d9a9aa0a0e3fcaa83d9365b2c3cc1447cb diff --cc ext/pdo/pdo_stmt.c index 6100f5b845,adc921bbd7..8ed0a77636 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@@ -1737,11 -1850,30 +1737,10 @@@ int pdo_stmt_setup_fetch_mode(pdo_stmt_ stmt->default_fetch_type = PDO_FETCH_BOTH; - if (argc == 0) { - return SUCCESS; - } - - args = safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval), 0); + flags = mode & PDO_FETCH_FLAGS; - retval = pdo_stmt_verify_mode(stmt, mode, 0); - retval = zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args); - - if (SUCCESS == retval) { - if (Z_TYPE(args[skip]) != IS_LONG) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "mode must be an integer"); - retval = FAILURE; - } else { - mode = Z_LVAL(args[skip]); - flags = mode & PDO_FETCH_FLAGS; - - /* pdo_stmt_verify_mode() returns a boolean value */ - retval = pdo_stmt_verify_mode(stmt, mode, 0) ? SUCCESS : FAILURE; - } - } - -- if (FAILURE == retval) { ++ if (!pdo_stmt_verify_mode(stmt, mode, 0)) { PDO_STMT_CLEAR_ERR(); - efree(args); return FAILURE; }