For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > May 2005 > Re: [PEAR] Issues using MDB2 with the DataObject cvs, possible MDB2 problem :)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Issues using MDB2 with the DataObject cvs, possible MDB2 problem :)
Justin Patrin

2005-05-30, 3:57 am

On 5/29/05, Dan Rossi <pear@electroteque.org> wrote:
> Hi there, some issues have arisen upgrading my MDB2 package. It has
> been working fine, I reverted my hacked up DataObject back to cvs so I
> can start making diffs from some of the changes, so its not that :) It
> only happens when I try and set the debug setting to on
>=20
> MDB2 Error: not supported __sleep : method not supported.
>=20
>=20
> The issue throwing the error is line 2137 of DataObject
> The issue has arisen in line 1573 of MDB2 in the __call method..
>=20
> if (is_null($module)) {
> ..
> ...
> ...
>=20
> }
>=20
> This however doesnt happen using DB. It looks like __call is trying to
> call a __sleep module or something ?=20


This is because the debug methods serialize the result object (and
maybe the DB object as well), which calls __sleep. IMHO this really
shouldn't be done on live objects for this exact reason. Look for
__sleep methods in MDB2 or remove the serialize calls from DO's debug
calls.

> My other issue is reverting back
> to DO, another problem has arisen where I was sending the db_options
> from a nested array of the DO settings. I have attempted to set it as a
> staticproperty of $db_options within the constructor of my class where
> I have setup the DO config, however its still not being sent or loaded
> to $db_options within the DO.
>=20
> I set it like this
>=20
> $db_options =3D PEAR::getStaticProperty('MDB2','options'
);

You need a & above otherwise you're just setting the same variable to
two different copies.
$db_options =3D& PEAR::getStaticProperty('MDB2','options'
);

> $db_options =3D $this->settings['DB_DataObject']['MDB2'];

No & here, though, or it won't work.

>=20
> Any ideas ?
>=20
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20
>=20



--=20
Justin Patrin
Dan Rossi

2005-05-30, 3:57 am


On 30/05/2005, at 2:33 PM, Justin Patrin wrote:
>
> This is because the debug methods serialize the result object (and
> maybe the DB object as well), which calls __sleep. IMHO this really
> shouldn't be done on live objects for this exact reason. Look for
> __sleep methods in MDB2 or remove the serialize calls from DO's debug
> calls.


I just removed the calls to serialize on two of the debug options and
all seems fine. What should I do about it now , i am trying to make my
version in sync with cvs , or else when someone updates pear its going
to break :)

> You need a & above otherwise you're just setting the same variable to
> two different copies.


Woah that was true for PHP5 too ?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com