vrana Tue Jul 27 17:17:23 2004 EDT
Modified files:
/phpdoc/en/language control-structures.xml
/phpdoc/en/appendices migration5.xml
Log:
Functions are defined even if they are after return statement in included file (bug
#26032)
http://cvs.php.net/diff.php/phpdoc/en/language/control-structures.xml?r1=1.100&r2=1.101&ty=u
Index: phpdoc/en/language/control-structures.xml
diff -u phpdoc/en/language/control-structures.xml:1.100
phpdoc/en/language/control-structures.xml:1.101
--- phpdoc/en/language/control-structures.xml:1.100 Tue Jul 27 17:00:22 2004
+++ phpdoc/en/language/control-structures.xml Tue Jul 27 17:17:22 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.100 $ -->
+<!-- $Revision: 1.101 $ -->
<chapter id="language.control-structures">
<title>Control Structures</title>
@@ -1500,6 +1500,15 @@
If the file can't be included, &false; is returned and
<literal>E_WARNING</literal> is issued.
</simpara>
+ <para>
+ If there are functions defined in the included file, they can be used in the
+ main file independent if they are before <function>return</function> 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.
+ It is recommended to use <function>include_once</function> instead of
+ checking if the file was already included and conditionally return inside
+ the included file.
+ </para>
<simpara>
A few other ways to "include" files into variables are with
<function>fopen</function>, <function>file</function> or by using
http://cvs.php.net/diff.php/phpdoc/en/appendices/migration5.xml?r1=1.27&r2=1.28&ty=u
Index: phpdoc/en/appendices/migration5.xml
diff -u phpdoc/en/appendices/migration5.xml:1.27
phpdoc/en/appendices/migration5.xml:1.28
--- phpdoc/en/appendices/migration5.xml:1.27 Mon Jul 26 13:52:31 2004
+++ phpdoc/en/appendices/migration5.xml Tue Jul 27 17:17:22 2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.27 $ -->
+<!-- $Revision: 1.28 $ -->
<appendix id="migration5">
<title>Migrating from PHP 4 to PHP 5</title>
@@ -105,6 +105,17 @@
<function>ip2long</function> now returns &false; when an invalid IP
address is passed as argument to the function, and no longer
<literal>-1</literal>.
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ If there are functions defined in the included file, they can be used in the
+ main file independent if they are before <function>return</function> 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.
+ It is recommended to use <function>include_once</function> instead of
+ checking if the file was already included and conditionally return inside
+ the included file.
</simpara>
</listitem>
<listitem>