You are here: Schroedinger's Bug - may require exorcism... « PHP « IT news, forums, messages
Schroedinger's Bug - may require exorcism...

Posted by Adam Atlas on 11/30/05 02:22

So... I have this script (being called in a perfectly typical way by
PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs
perfectly, and sometimes chooses, totally haphazardly, to seemingly
run itself twice, which of course causes it to die with a fatal error
after it tries to redefine some functions.

As mysterious as that is, it turns out it must be something
altogether more sinister. I tried putting die() at the end of the
script, on the assumption that it was for some reason executing
twice, yet behold: the problem is still present, and the PHP error
log still complains about constants and functions being redefined!
The problem, I therefore thought, cannot be that the script is being
run twice. (In retrospect, this was the most likely possibility,
because the page doesn't actually output anything if it dies with
this error.) So for debugging, I added a bit that logs one message to
a file immediately before the die() at the end of the file, and a
different message after the die(). The die() seems to be working
normally, in that it only logs the first message...

But wait a second! WTF? If the PHP error log is to be believed, then
the script should be dying with a fatal error before it even *gets*
to that point in the script, isn't it?

And the greater WTF is the fact that, as I mentioned above, every
time the page is requested, it unpredictably either does this or
works flawlessly. Oh my. How do I even *begin* to debug something
like this?

Thanks for any help.
-- Adam Atlas

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация