ID:               30723
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php dot devel at homelinkcs dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Mandrake Linux 10.0
 PHP Version:      Irrelevant
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.

"about it" means "about functions defined after return".


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

[2004-11-08 22:39:00] php dot devel at homelinkcs dot com

Description:
------------
The documentation page for the include() construct states  
that:   
  
"If there are functions defined in the included file, they  
can be used in the main file independent if they are  
before return() or after. If the file is included twice,  
PHP 5 issues fatal error because functions were already  
declared, while PHP 4 doesn't complain about it."  
  
However, PHP 4 _does_ "complain" (which it should) about  
it as demonstrated below.  Therefore, I believe the second  
sentence in the quote above should read, "If the file is  
included twice, a  fatal error is issued because functions  
were already declared."  
  
  

Reproduce code:
---------------
a.php:
<?php
        include("b.php");
        include("b.php");
?>

b.php:
<?php
        function foo() {
                echo "I've been included!\n";
        }
?>

Running a.php, PHP 4.3.4 dies with:
Fatal error: Cannot redeclare foo() (previously declared in
/tmp/b.php:3) in /tmp/b.php on line 2




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


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

Reply via email to