Forum Moderators: coopster

Message Too Old, No Replies

Table doesn't exist in Opera only with session handler

         

Fourjays

3:04 pm on Aug 5, 2009 (gmt 0)

10+ Year Member



This is the weirdest issue I have ever come across in 4 years of coding PHP...

I've just finished a basic (compared to the likes of Zend at least) framework of my own. Everything works great in Firefox and IE - no issues whatsoever.

I just went into Opera to test a Javascript issue I've been having problems with, and it has thrown a load of errors at me. These must be browser specific issues - I've cleaned caches, cookies, etc from Firefox, IE and Opera, and Opera is still the only browser getting these errors.

There are two parts to the errors.
Part 1:
The first error is "ob_end_clean() [ref.outcontrol]: failed to delete buffer. No buffer to delete. in D:\Documents\WWW\io\Io\Error.php".

This is in my error controller which cleans the buffer and restarts it so only the error is displayed (no random bits of half-finished page). Now I can see why this is coming up - the buffer HAS been sent. The page displayed, perfectly fine, above the errors.

Part 2:
This error is coming from MySQL through my session handler: "Table 'io.localhostsessions' doesn't exist". It does exist - Firefox and IE are accessing sessions no problem in the rest of the script, and so is Opera apparently (a user access check performs an isset on the session, so it must use it within the script).

Now what I believe is causing the first issue is that the end of the script has been reached, the buffer sent (ob_end_flush is the last line) and then PHP itself is doing something with the session handler afterwards (I guess - don't know much about the internal workings). That would explain why the buffer is throwing an error.

However, it doesn't explain why Opera, and Opera alone is unable to find the sessions table at this point!

So my question is - any ideas as to what is causing this?

Thanks :)

Fourjays

3:51 pm on Aug 5, 2009 (gmt 0)

10+ Year Member



May this be a clue...

I deliberately renamed the table so it actually doesn't exist, and all browsers (including Opera) output "io.io_sessions", instead of "io.localhostsessions" which Opera puts out when all other browsers work fine. All database tables are written with a proceeding _ in queries, which a method then replaces with the configured table prefix.

So a query is written "SELECT foo FROM _bar", and the method then changes it to "SELECT foo FROM prefix_bar".

But I don't see how Opera could interfere with that at all. :/

Fourjays

4:14 pm on Aug 5, 2009 (gmt 0)

10+ Year Member



Ok... getting somewhere.

I've called my debugger within the database class on itself.
Firefox/IE are making only 2 queries, with a prefix of "io" (correct). Opera does a third query after the script has finished executing, with a prefix of "localhost"... no clue where it's getting it from.

Fourjays

4:23 pm on Aug 5, 2009 (gmt 0)

10+ Year Member



Solved it.

The prefix comes from a SimpleXML object. Typecasting it as a string has fixed the issue. No idea why it affected Opera only, so any information would be appreciated.