Howdy all.
I have defined "__HEADER_INC__" in header.inc.php3 and also made the requires that require header.inc.php3 conditional.
Also, a slight programmer note: Anyone adding code to this project should, when requiring header.inc.php3, only do it if !defined('__HEADER_INC___').
Jeremy
Also, a slight programmer note: Anyone adding code to this project should, when requiring header.inc.php3, only do it if !defined('__HEADER_INC___').
-----
'nother typo. Someone chop of my hands for today.
should be
__HEADER_INC__ (two underscores (_) at the end, not three)
Jeremy Brand :: Sr. Software Engineer :: +393485323988 :: jeremy@nirvani.net http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "LINUX is obsolete" -- Andy Tanenbaum, January 29th, 1992 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Get your own Free, Private email at http://www.smackdown.com/
Hi Jeremy,
from the PHP manual: -------------------- require() is not actually a function in PHP; rather, it is a language construct. It is subject to some different rules than functions are. For instance, require() is not subject to any containing control structures.
Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed. -----------------------
If I understand correctly the manual, this code won't work:
if (!defined('__HEADER_INC__')) require("./header.inc.php3");
Marc
jeremy brand a écrit :
Howdy all.
I have defined "__HEADER_INC__" in header.inc.php3 and also made the requires that require header.inc.php3 conditional.
Also, a slight programmer note: Anyone adding code to this project should, when requiring header.inc.php3, only do it if !defined('__HEADER_INC___').
Jeremy
On Thu, 26 Jul 2001, Marc Delisle wrote:
Hi Jeremy,
from the PHP manual:
require() is not actually a function in PHP; rather, it is a language construct. It is subject to some different rules than functions are. For instance, require() is not subject to any containing control structures.
Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed.
If I understand correctly the manual, this code won't work:
if (!defined('__HEADER_INC__')) require("./header.inc.php3");
Marc
However, this will:
if (!defined('__HEADER_INC__')) { require("./header.inc.php3"); };
The only problem is that variables defined in header.inc.php3 and not in the require()ing file won't be visible outside of the braces.
Hi Marc,
Personally, I never use require().. I've only used require because that seemed to be the norm in phpMyAdmin.
So, in my thinking, everywhere I wrote require, it should have been an include (that is just how my brain works).
Anyhow.. I don't fully understand phpMyAdmin because I have not spent the effort to.
I have stong feelings about the include-require issue. It was so long ago that I came to a conclusion (that being that I don't use require in my projects and only use include), that it didn't even occur to me here.
Jeremy
Jeremy,
thanks for the patch. However, I think the current logic in phpMyAdmin needs those multiple includes of header.inc.php3, and that the only problem is to avoid including ob_lib.inc.php3.
I tried to use the same trick as lib.inc.php3: put all the logic in {} after the first if, but I get 3 lines of garbage when I try the "empty table copy name" test.
Marc
jeremy brand a écrit :
Howdy all.
I have defined "__HEADER_INC__" in header.inc.php3 and also made the requires that require header.inc.php3 conditional.
Marc,
Maybe I just just move the function in ob_lib.inc.php3 into lib.inc.php3?
My stuff doesn't care where it comes from, only that it is available.
Just a though.
Jeremy
Did I already say cut my hands off today? (major typos)
I'll rewrite this:
Maybe I should just move the functions in ob_lib.inc.php3 into lib.inc.php3?
My stuff doesn't care where it comes from, only that it is available.
Just a thought.
Jeremy
Marc,
Maybe I just just move the function in ob_lib.inc.php3 into lib.inc.php3?
My stuff doesn't care where it comes from, only that it is available.
Just a though.
Jeremy
Jeremy,
I tried that. Same 3 lines of garbage with the test.
Can you try it by yourself?
jeremy brand a écrit :
Marc,
Maybe I just just move the function in ob_lib.inc.php3 into lib.inc.php3?
My stuff doesn't care where it comes from, only that it is available.
Just a though.
Jeremy
Hi Marc.
Let's not forget my theory about the real problem. I still believe that header.inc.php3 is being used more than once per execution.
If that gets fixed, the other issue of redefining functions should go away.
I can't test until tomorrow. No database here currently.
Again, this safty net was only an attempt to catch whatever other piece of code is executing wrongly and requiring header.inc.php3 more than once.
Jeremy
I tried that. Same 3 lines of garbage with the test.
Can you try it by yourself?
jeremy brand a �crit :
Marc,
Maybe I just just move the function in ob_lib.inc.php3 into lib.inc.php3?
My stuff doesn't care where it comes from, only that it is available.
Just a though.
Jeremy
Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel