fluentpdo icon indicating copy to clipboard operation
fluentpdo copied to clipboard

PHP Fatal error on BaseQuery::execute() error

Open cxj opened this issue 12 years ago • 6 comments

Because SelectQuery::fetch() and its brethren call PDO::fetch() this way

$this->execute()->fetch();

any time execute() fails and returns false instead of an object, the PHP script terminates with a fatal PHP error, with a message like this:

Thu Jun 20 13:38:38 2013] [error] [client fe80::1] PHP Fatal error:  Call to a member function fetchAll() on a non-object in FluentPDO/SelectQuery.php on line 115

Could better error handling be implemented?

cxj avatar Jun 20 '13 18:06 cxj

Actually, the PDO::prepare($query) call should catch the error that caused this, but again, there is no way I can see to catch that error in the user code.

cxj avatar Jun 20 '13 19:06 cxj

could be if someone write a pull request ;-)

lichtner avatar Jun 20 '13 19:06 lichtner

Working on it! :-)

cxj avatar Jul 05 '13 04:07 cxj

Sorry if the pull requests are messed up. The new Github interface confuses me as to just exactly what it's going to do sometimes.

cxj avatar Jul 06 '13 01:07 cxj

I'm facing the same issue using fluentpdo. i extend the class as a base model and i cant seem to figure out why it stopped woking. please help

skipperstrange avatar Oct 29 '20 02:10 skipperstrange

@skipperstrange can you add the code you're using to extend fluent?

cbornhoft avatar Nov 01 '20 19:11 cbornhoft