mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/pdo: Throw an exception instead of fatal error if the class is not found (#17528)
This commit is contained in:
committed by
GitHub
parent
9283abc1a0
commit
6bd2b8dfa5
@@ -1231,7 +1231,7 @@ PHP_METHOD(PDOStatement, fetchAll)
|
||||
zend_argument_type_error(2, "must be of type string, %s given", zend_zval_value_name(arg2));
|
||||
RETURN_THROWS();
|
||||
}
|
||||
stmt->fetch.cls.ce = zend_fetch_class(Z_STR_P(arg2), ZEND_FETCH_CLASS_AUTO);
|
||||
stmt->fetch.cls.ce = zend_lookup_class(Z_STR_P(arg2));
|
||||
if (!stmt->fetch.cls.ce) {
|
||||
zend_argument_type_error(2, "must be a valid class");
|
||||
RETURN_THROWS();
|
||||
|
||||
@@ -39,7 +39,6 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
|
||||
$db = PDOTest::factory();
|
||||
PDOTest::dropTableIfExists($db, "pdo_fetch_all_class_error_unknown");
|
||||
?>
|
||||
--EXPECTF--
|
||||
--EXPECT--
|
||||
TypeError: PDOStatement::setFetchMode(): Argument #2 must be a valid class
|
||||
|
||||
Fatal error: Class "Unknown" not found in %s on line %d
|
||||
TypeError: PDOStatement::fetchAll(): Argument #2 must be a valid class
|
||||
|
||||
Reference in New Issue
Block a user