Jump to content

PDO Not Throwing Exceptions on Errors


Jonathan

Recommended Posts

I'm not sure when it stopped (version), but PDO (Record) isn't throwing exceptions when erroneous queries are thrown at it.  I tracked this down to PDO::ERRMODE_EXCEPTION not being set on the actual queries.  When I set this manually in the library all of the built in exceptions worked as expected again.

I see code in the minphp PDO library that's supposed to set PDO::ERRMODE_EXCEPTION but it's not getting set for some reason, at least not on plugin-related things when using Record.

To recreate, take a plugin, do something to a query via Record that will throw a MySQL error.  The result is Blesta thinks things succeeded instead of throwing an error on the exception from the try/catch block since the exception was never thrown.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...