Reply to Re: [PHP] Global class instances mysteriously set to NULL

Your name:

Reply:


Posted by James on 01/10/05 00:24

> As long as you've got something that is consistent and reproducible then
> eventually some sense can be made out of it. But if you're saying that
> running the same code without changes repeatedly will give random results
> then *that* doesn't make sense.

Very true. I wasn't too clear.

Switching around (and removing) require_once in different source files
does cause different results *consistently*.

If I have "require_once 'uAuthenticate.php'" in one source file it
causes the problem, but if remove it, or add/remove it from another
source file the problem goes away.

What I mean by "no rhyme or reason" is that even though I get consistent
results of problem/no problem, I see no pattern to what causes the
problem and what does not. It's really screwy, at least from my
understanding of how require_once should work. (It's possible of course
that I simply may be misinterpreting the documentation.)

While I would like to understand the problem so that I know "don't do
that you fool," I also am short on time.

I was able to find a work-around thus:

1) In the source file that's the #1 problem child I changed

require_once 'uAuthenticate.php';

to

require 'uAuthenticate.php';

2) in uAuthenticate.php I changed

$Auth = new TAuthenticate;

to

if(!isset($Auth))
$Auth = new TAuthenticate;


This doesn't seem to nuke the global $Auth.

[Back to original 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

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