FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » out of sheer curiosity...
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: out of sheer curiosity... [message #177620 is a reply to message #177616] Tue, 10 April 2012 22:13 Go to previous messageGo to previous message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma:
Senior Member
Jerry Stuckle schrieb:

> I no longer even try to store objects in the session. It's hopeless.

Why? I never had any real problems with storing objects in the session.
Or maybe I was just lucky ;-)

> For instance - what if one of the things your object needs is a database
> connection? And what if you have several objects using that same
> connection? There is no way to pass an existing database connection to
> __wakeup(). You either have to use a global variable, restricting
> variable names in the rest of your code and limiting flexibility, or
> create a new connection in the __wakeup() call or remember to call
> another method to set the database connection after unserializing the
> object.

MyDatabaseSingleton::getInstance() ?

> None are good answers - but all could be easily handled with proper use
> of constructors.

And how would a "proper use of constructors" solve the above problem?
Even if unserialize() called __construct(), you would have no chance to
pass any arguments to the constructor.

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 5.4 windows installer.
Next Topic: Does PHP5 treat $_SERVER['PHP_AUTH_USER']) differently?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 13:55:45 GMT 2024

Total time taken to generate the page: 0.05404 seconds