fuel / core

Fuel PHP Framework - The core of the Fuel v1 framework
http://fuelphp.com
813 stars 345 forks source link

Error code missing from exception thrown in core/classes/database/pdo/connection.php #1090

Closed crankycyclops closed 12 years ago

crankycyclops commented 12 years ago

Hi there! I was trying to get the error code for a MySQL error when attempting a query and was unable to get it from the Exception that was thrown. I discovered that, for whatever reason, the exception thrown by FuelPHP ignores the error code returned by the exception thrown by PDO. Here's a simple patch that fixes it.

diff -urN fuel-orig/fuel/core/classes/database/pdo/connection.php fuel-new/fuel/core/classes/database/pdo/connection.php --- fuel-orig/fuel/core/classes/database/pdo/connection.php 2011-10-24 14:58:34.000000000 -0700 +++ fuel-new/fuel/core/classes/database/pdo/connection.php 2012-04-15 17:29:25.286039621 -0700 @@ -134,7 +134,7 @@ }

// Convert the exception in a database exception

crankycyclops commented 12 years ago

Note that I originally discovered and fixed the issue in 1.1, but checked and verified that it's still a problem in 1.2.1. Hope this is helpful!

floorish commented 12 years ago

This fix gives the following error when trying to migrate:

FUEL_ENV=test php oil r migrate
Error: A non well formed numeric value encountered in /var/www/../fuel/core/classes/database/pdo/connection.php on 167

If I revert 49ba30a it works... not sure what is going on unfortunately

lukearmstrong commented 12 years ago

@floorish fixed here: https://github.com/fuel/core/pull/1128

floorish commented 12 years ago

@lukearmstrong thanks!