Re: Passing error codes through to PDOException
| From: | Joey Smith | Date: | Tue, 12 Jan 2010 03:59:46 +0000 |
| Subject: | Re: Passing error codes through to PDOException | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46653@lists.php.net to get a copy of this message | ||
I also just attached the following to the bug - it's a test that checks this fix in
the sqlite driver - I can write tests for all the others if need be, but I figured
there are others who might already be more familiar with the individual PDO drivers
that would write them more quickly than I.
--TEST-- Bug #50728 (All PDOExceptions hardcode 'code' property to 0) (crash on PDO::FETCH_CLASS + __set()) --SKIPIF-- <?php # vim:ft=php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?> --FILE-- <?php try { $a = new PDO("sqlite:/this/path/should/not/exist.db"); } catch (PDOException $e) { var_dump($e->getCode()); } ?> --EXPECTF-- int(14)
--TEST-- Bug #50728 (All PDOExceptions hardcode 'code' property to 0) (crash on PDO::FETCH_CLASS + __set()) --SKIPIF-- <?php # vim:ft=php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?> --FILE-- <?php try { $a = new PDO("sqlite:/this/path/should/not/exist.db"); } catch (PDOException $e) { var_dump($e->getCode()); } ?> --EXPECTF-- int(14)