[mythtv-commits] Ticket #2982: mythweb session.php
MythTV
mythtv at cvs.mythtv.org
Fri Jan 26 21:44:32 UTC 2007
#2982: mythweb session.php
-----------------------+----------------------------------------------------
Reporter: anonymous | Owner: xris
Type: defect | Status: reopened
Priority: minor | Milestone: unknown
Component: mythweb | Version: head
Severity: low | Resolution:
-----------------------+----------------------------------------------------
Comment (by jcrandall at alum.mit.edu):
I tried to back out [10527] and [10544] but there seem to have been too
many changes to the Database objects since then to apply it. Anyway, I
pursued alternate debugging approaches and I now believe I understand this
bug.
Checking the PHP5 documentation for {{{session_set_save_handle}}}
(http://us2.php.net/session_set_save_handler) I noticed the warning:
"Write and Close handlers are called after destructing objects since PHP
5.0.5. Thus destructors can use sessions but session handler can't use
objects. In prior versions, they were called in the opposite order. It is
possible to call session_write_close() from the destructor to solve this
chicken and egg problem."
I believe what is happening here is that {{{sess_write}}} is now being
called after the database object is destroyed. I have confirmed that a
workaround for this is to call {{{session_write_close();}}} just before
the PHP script calls {{{exit;}}}.
The only reason I can think of why other people are not seeing this error
is that perhaps they have {{{error_reporting}}} set to something else than
we do. Mine is set to:
{{{
error_reporting = E_ALL & ~E_NOTICE
}}}
in my system php.ini file.
I am having a problem locating the most appropriate place in the code to
put the {{{session_write_close();}}} call. I currently have it in
{{{modules/_shared/tmpl/default/footer.php}}}, just after the code block
for displaying footnotes and before the end of the PHP. That works fine,
but IMO is not really where it belongs, since it is certainly not a
"display" element. It could also be added to the end of each module,
between the template call and the {{{exit;}}} but that is kind of a mess
too, since it needs to be all over the place.
A better place to put it might be in the destructor for the database
classes, but I am having trouble getting that to work for some reason (I'm
not a PHP guy and the PHP5 classes are totally new to me). Ideally it
would be in the {{{Database}}} object and would be inherited by each of
the database implementations, but I'm not clear on whether an abstract
class can have a destructor implementation...
xris, with this explanation, can you recommend a change that fixes it
cleanly?
Alternatively, if you think it's ok to just add the
{{{session_write_close();}}} before {{{exit;}}} in each of the modules, I
can submit a patch that does that and that is working just fine for me.
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/2982#comment:7>
MythTV <http://www.mythtv.org/>
MythTV
More information about the mythtv-commits
mailing list