|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-02-16 20:00 UTC] matthew at baggett dot me
Description:
------------
PDO query does not throw exceptions when table missing when FETCH_CLASS used.
Nothing interesting to see in PDO::errorCode() either.
Test script:
---------------
does not throw exception:
PDO::Query("SELECT tde.* FROM table_doesnt_exist tde", \PDO::FETCH_CLASS, 'StdClass');
does throw exception:
PDO::Query("SELECT tde.* FROM table_doesnt_exist tde");
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 16:00:01 2025 UTC |
Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. Works for me. $pdo = new PDO(/* ... */); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $pdo->query("SELECT tde.* FROM table_doesnt_exist tde", PDO::FETCH_CLASS, 'stdClass'); Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.table_doesnt_exist' doesn't exist' in %s on line %d