Re: Best way to configure DB_DataObject?

From: Date: Mon, 13 Feb 2006 14:57:49 +0000
Subject: Re: Best way to configure DB_DataObject?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22948@lists.php.net to get a copy of this message
Hey Phil, On 2/13/06, Phil Gyford <gyford@gmail.com> wrote: > > Hi, > > I'm using DB_DataObject and setting its options as suggested in the > documentation: > > $options = &PEAR::getStaticProperty('DB_DataObject','options'); > $options = array( > 'database' => 'mysql://user:password@localhost/vending', > 'schema_location' => '/home/me/Projects/myapplication/DataObjects', > 'class_location' => '/home/me/Projects/myapplication/DataObjects', > 'require_prefix' => 'DataObjects/', > 'class_prefix' => 'DataObjects_', > ); > > > However, I've noticed that if something is up with the database, eg, > connections refused or the password changes, then an error message is > displayed to the screen, which includes the DSN (I have display_errors and > display_startup_errors set to 0). > > I can suppress this error by setting dont_die=>true in the options, but > I'd > prefer to die gracefully, displaying an error to the user, rather than a > blank screen. How can I do this? I've tried looking at DB_DataObject's > LastError property with no joy. > > I have a custom error handling function that usually works fine, but I > can't > see how to detect for an error here and then use that function...? Do you know the version of DB_DataObject you're using? I ran in to a similar issue and with some creative searching found a bug that was fixed. My guess is that you're referring to the bug #4096 ( http://pear.php.net/bugs/bug.php?id=4096) which was quietly fixed... although IMHO that bug should have at least made it into the changelog so more people would have known about that security bug. I mean the entire dsn with password was sent to the client regardless of debugLevel or display_errors. My suggestion is to pear upgrade DB_DataObject... and see if that fixes the problem.... and that goes for everyone using DB_DataObject < 1.7.14 for that instance your database is down for some reason or another. Thanks, > Phil > > -- -Brett http:saltybeagle.com aim:ianswerq

« previous php.pear.general (#22948) next »