Re: PEAR::Error and MDB

From: Date: Fri, 11 Apr 2003 10:30:57 +0000
Subject: Re: PEAR::Error and MDB
References: 1  Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-15111@lists.php.net to get a copy of this message
Jeroen Houben wrote:
Hi, I have a piece of code at the start of my script: PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'error_handler'); This is just to catch errors without having to check for errors after each operation. I use MDB and the connection generates errors like: MDB Error: not supported -6 unknown option includelob You don't notice these errors when you just do a check on the returned object: like $db = $db=&MDB::connect(DSN); if (PEAR::isError($db)) { //do something } because the errors seem to happen inside the MDB class. The script then runs fine. The problem is that I cannot really use PEAR::setErrorHandling anymore because it catches errors inside the MDB classes (and perhaps in other classes as well?) which should be ignored (I think). I'm using POstgres 7.2.1 and MDB 1.1.2-RC1. Any ideas on how to overcome this? Jeroen -- here's a dump of the error object -- object(mdb_error)(8) { ["error_message_prefix"]=> string(0) "" ["mode"]=> int(16) ["level"]=> int(1024) ["code"]=> int(-6) ["message"]=> string(24) "MDB Error: not supported" ["userinfo"]=> string(25) "unknown option includelob" ["backtrace"]=> array(7) { [0]=> array(6) { ["file"]=> string(33) "/usr/local/share/php/pear/MDB.php" ["line"]=> int(645) ["function"]=> string(10) "pear_error" ["class"]=> string(9) "mdb_error" ["type"]=> string(2) "->" ["args"]=> array(5) { [0]=> &string(24) "MDB Error: not supported" [1]=> ?(-6) [2]=> ?(16) [3]=> &string(13) "error_handler" [4]=> &string(25) "unknown option includelob" } } [1]=> array(6) { ["file"]=> string(34) "/usr/local/share/php/pear/PEAR.php" ["line"]=> int(508) ["function"]=> string(9) "mdb_error" ["class"]=> string(9) "mdb_error" ["type"]=> string(2) "->" ["args"]=> array(4) { [0]=> ?(-6) [1]=> ?(16) [2]=> &string(13) "error_handler" [3]=> &string(25) "unknown option includelob" } } [2]=> array(6) { ["file"]=> string(40) "/usr/local/share/php/pear/MDB/Common.php" ["line"]=> int(271) ["function"]=> string(10) "raiseerror" ["class"]=> string(4) "pear" ["type"]=> string(2) "::" ["args"]=> array(7) { [0]=> &NULL [1]=> ?(-6) [2]=> &NULL [3]=> &NULL [4]=> &string(25) "unknown option includelob" [5]=> &string(9) "MDB_Error" [6]=> &bool(true) } } [3]=> array(6) { ["file"]=> string(40) "/usr/local/share/php/pear/MDB/Common.php" ["line"]=> int(349) ["function"]=> string(10) "raiseerror" ["class"]=> string(9) "mdb_pgsql" ["type"]=> string(2) "->" ["args"]=> array(4) { [0]=> ?(-6) [1]=> &NULL [2]=> &NULL [3]=> &string(25) "unknown option includelob" } } [4]=> array(6) { ["file"]=> string(33) "/usr/local/share/php/pear/MDB.php" ["line"]=> int(315) ["function"]=> string(9) "getoption" ["class"]=> string(9) "mdb_pgsql" ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> &string(10) "includelob" } } [5]=> array(6) { ["file"]=> string(41) "/pub/www/www3.terena.nl/private/start.php" ["line"]=> int(10) ["function"]=> string(7) "connect" ["class"]=> string(3) "mdb" ["type"]=> string(2) "::" ["args"]=> array(1) { [0]=> &string(40) "pgsql://postgres:xxxxxx@localhost/sixnet" } } [6]=> array(4) { ["file"]=> string(44) "/pub/www/www3.terena.nl/private/contacts.php" ["line"]=> int(2) ["args"]=> array(1) { [0]=> string(41) "/pub/www/www3.terena.nl/private/start.php" } ["function"]=> string(12) "require_once" } } ["callback"]=> string(13) "error_handler" } I wonder if this is related to an earlier post - http://marc.theaimsgroup.com/?l=pear-dev&m=104991437416863&w=2
- Jeroen

« previous php.pear.dev (#15111) next »