PHP 4.0 Bug #7710 Updated: include'ing doesn't work properly
| From: | zeev@php.net | Date: | Sat, 25 Nov 2000 14:38:06 +0000 |
| Subject: | PHP 4.0 Bug #7710 Updated: include'ing doesn't work properly | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39117@lists.php.net to get a copy of this message | ||
ID: 7710
Updated by: zeev
Reported By: brozen@torah.org
Status: Open
Bug Type: Documentation problem
Assigned To:
Comments:
This is in fact a documentation issue.
PHP 4.0 changed the behavior of require(), and each separate file must now be parsable by itself.
It's a result of a fundemental change that took place between PHP 3 and 4, and this behavior
will remain as is...
You'd have to find an alternative way of doing what you want (which should be fairly easy).
Doc team: The documentation for require() is no longer close to being accurate for PHP 4.0 in
general, and PHP 4.0.2&later in particular... It's basically just like include() today,
except it can't fail, and would bail out if it does.
Previous Comments:
---------------------------------------------------------------------------
[2000-11-20 05:31:18] brozen@torah.org
index.php3:
<? require "header.php3"; ?>
sid is set
<? require "footer.php3"; ?>
header.php3:
<?
if (isset($sid))
{
?>
footer.php3:
<?
}
else
{
echo "sid not set";
}
?>
---------------------------------------------------------------------------
[2000-11-20 05:28:02] brozen@torah.org
This is not a documentation issue. Read this again before you respond so quickly.
---------------------------------------------------------------------------
[2000-11-09 09:52:30] sniper@php.net
Please read this manual page carefully:
http://www.php.net/manual/function.require.php
---
Changed to Documentation problem as I couldn't
find the incompatibilities list (for PHP 3 vs. PHP 4)
from the manual.
--Jani
---------------------------------------------------------------------------
[2000-11-09 01:45:37] brozen@torah.org
This bug is also reported at:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=75695
---------------------------------------------------------------------------
[2000-11-09 01:42:19] brozen@torah.org
Please take a look at this: (php3)
http://zeraim.torah.org/~cblack/testdir/index.php3
http://zeraim.torah.org/~cblack/testdir/index.php3?sid=3
Now, try these: (php4)
http://terumah.teamgenesis.com/~cblack/index.php3
http://terumah.teamgenesis.com/~cblack/index.php3?sid=2
Precisely the same code. PHP on zeraim incorporates the header & footer and then parses all as
one, while on terumah it is attempting to parse the header & footer as if they were independent
of the file into which they are included.
Or in other words, PHP3 used to incorporate a 'require()ed' file without doing any work on
it, and then parsed the whole thing together. So you could have an IF statement in the header [ if
(...) { ] that ended in the footer [ } ].
No longer! That's why the same code is generating parse errors.
---------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view the rest of the comments,
please view the bug report online.
Full Bug description available at: http://bugs.php.net/?id=7710