ID:               33579
 User updated by:  aarondoom at cookiedoom dot com
 Reported By:      aarondoom at cookiedoom dot com
-Status:           Bogus
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Gentoo Linux 1.6.12
 PHP Version:      4.4.0
 New Comment:

It is obvious you have no idea what is going on and the reason they
need to be there.

I may from one page load one include instead of another.  I'm not going
to use ugly stupid code when there are hundreds of files to update
merely to work around this bug.

There is a problem here and it is within the PHP engine.  I'm sorry
that you do not wish to fix it.

I sincerely hope you people are more helpful to others.

Thanks anyway for not looking into the issue.


Previous Comments:
------------------------------------------------------------------------

[2005-07-06 01:51:31] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Try nuke those stupid define()'s and use require_once() instead..


------------------------------------------------------------------------

[2005-07-06 01:42:27] aarondoom at cookiedoom dot com

Here's an update to the code, this reproduces the "Bug".

<?php // Test.php
require("Header.inc");
Bleh();
?>

<?php // Header.inc
require("Funcs.inc");
require("Emails.inc");

Bleh(); // Won't error
?>

<?php // Funcs.inc
if (!defined("_FUNCS_INC_")) {
  define("_FUNCS_INC_", true);

  require("DB.inc");

  function Bleh() { printf("Blah\n"); }
} // _FUNCS_INC_
?>

<?php // Emails.inc
if (!defined("_EMAILS_INC_")) {
  define("_EMAILS_INC_", true);

  require("DB.inc");
} // _EMAILS_INC_
?>

<?php // DB.inc
if (!defined("_DB_INC_")) {
  define("_DB_INC_", true);

  require("Funcs.inc");

  Bleh();
} // _DB_INC_
?>

------------------------------------------------------------------------

[2005-07-06 01:30:39] aarondoom at cookiedoom dot com

http://wwwtest.amberalert911.net/debug.php

debug.php includes funcs.inc

funcs.inc includes emails.inc global.inc

emails.inc includes db.inc funcs.inc forms.inc MailServer.inc

db.inc includes funcs.inc global.inc

forms.inc includes db.inc

As you can see, it's not working as you defined.  If this is not a bug
with PHP, perhaps it's a bug in Apache?

I was able to execute my example via the command line PHP, but not the
debug.php via the command line.  Not sure what the difference really
is.  The example is much simpler of course.

All of the listed files are quite large, no smaller than 200 lines each
so I'm not going to post them here, but look at the URI listed above.

------------------------------------------------------------------------

[2005-07-06 00:42:33] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Works just fine with all versions I can test right now (4.3, 4.4, 5.0,
5.1 etc.).

------------------------------------------------------------------------

[2005-07-05 23:37:44] aarondoom at cookiedoom dot com

Description:
------------
When a parent document requires a source file and then requires a
second file that requires the same as above it cannot access the
functions in the already required file from the parent, but cannot use
or redefine the functions that are required.
Using code that "if (!defined("_FUNCS_INC_")) { define("_FUNCS_INC_",
true); function Bleh($Bloop) { return $Bloop; } } // _FUNCS_INC_".
This is a problem because the _FUNCS_INC_ is defined as well as the
functions defined inside of the scope of the document though
function_exists will return false and calling the function will
obviously fail for that reason, I cannot redefine those functions in
the sub-document or I'll get "Cannot redefine function bleh"... even
though I can't use it.
Though it is easy enough to work around the issue (With the "if
(!defined())" stuff require_once doesn't even make it work BTW) I'm
reorganizing several hundred files, at least 1/3 of which are includes
which need to be re-ordered.
Any help would be greatly appreciated.

Reproduce code:
---------------
<?php // Funcs.inc
if (!defined("_FUNCS_INC_")) {
  define("_FUNCS_INC_", true);

  function Bleh() { printf("Blah\n"); }
} // _FUNCS_INC_
?>

<?php // DB.inc
require("Funcs.inc");
Bleh();
?>

<?php // Header.inc
require("Funcs.inc");
require("DB.inc");

Bleh(); // Won't error
?>

Expected result:
----------------
Blah\n
Blah\n

Actual result:
--------------
Fatal error: Call to undefined function: bleh() in
/var/www/localhost/includes/DB.inc on line 3


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33579&edit=1

Reply via email to