Richard Lynch wrote:
On Fri, January 5, 2007 4:36 pm, Stut wrote:
Richard Lynch wrote:
WILD GUESS
Search on php.net for __autoload
I think that will let you figure out a way to get the auto_start
session to automatically load your .class.php files, when it needs
them.
Nice idea, unfortunately it doesn't work that way. In order to have
the
__autoload function work properly for session'd objects it needs to be
declared before the session is started. AFAIK when auto_start is on
the
session is started before any PHP is evaluated. I had to shift one of
my
frameworks around so that the __autoload was declared before
session_start was called.
I think Jochem may be on to something with the idea of using
auto_prepend_file but I can't say for certain whether this is done
before or after the auto_start. If it is before then you could declare
the __autoload function in the prepended file and it should work.
Another possibility...
Do a session_write_close() to kill of the auto_start session.
Then, using session_name() and session_id() and
session_set_cookie_params() force your OWN session control, completely
independent of the auto_start session, which you can do AFTER you have
done your include()s
This should allow you to do what you want with the fewest conceptual
changes, at the price of a bogus auto_start session being wastefully
used by your webhost -- which seems pretty brain-dead to me, but there
it is.
Evil. Pure evil.
Personally I'd rather go through the hassle of either mail-bombing my
current host until they realise how stupid they're being, or simply
switch host.
-Stut
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php