Re: Best way to configure DB_DataObject?
| From: | Phil Gyford | Date: | Tue, 14 Feb 2006 08:19:23 +0000 |
| Subject: | Re: Best way to configure DB_DataObject? | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22955@lists.php.net to get a copy of this message | ||
Hi Brett,
Thanks for the pointer - yes, my version of DB_DataObject was older (I'm
usually cautious about upgrades!). The latest version does fix the problem,
thanks.
Unfortunately the latest version causes my code to issue a "Cant find
database schema" fatal error part-way through the page, after several
successful database queries! I'll have to root around and see what I've done
wrong that's lain hidden until now, or what else has changed in
DB_DataObject.
Anyway, thanks again for the tip,
Phil
On 2/13/06, Brett Bieber <brett.bieber@gmail.com> wrote:
>
> 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
>
>