PHP 4.0 Bug #4402: if() does not work across included files
| From: | ct at arborinternet dot com | Date: | Thu, 11 May 2000 16:50:11 +0000 |
| Subject: | PHP 4.0 Bug #4402: if() does not work across included files | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18616@lists.php.net to get a copy of this message | ||
From: ct@arborinternet.com
Operating system: FreeBSD
PHP version: 4.0 Release Candidate 2
PHP Bug Type: Scripting Engine problem
Bug description: if() does not work across included files
The following worked in PHP3, but does not work in PHP4. There are three files, the first
'test.php' includes the other two 'test1.php' and 'test2.php'.
test.php:
<?php
include('test1.php');
include('test2.php');
?>
test1.php:
<?php
$myvar = 1;
if ($myvar) {
?>
test2.php:
<html><body>mynum = 1</body></html>
<?php
} else {
?>
<html><body>mynum = 0</body>
</html>
<?php
}
?>
Error messages with using include():
Parse error: parse error in test1.php on line 4
Parse error: parse error in test2.php on line 8
Error messages with using require():
Parse error: parse error in test1.php on line 4
Configure parameters:
% ./configure --enable-track-vars --with-apxs=/usr/local/apache/1.3/bin/apxs --with-mysql
--enable-trans-sid --enable-versioning
The documentation indicates that include() and require() will treat the included file as if it were
part of the main file. I believe having if() work across included files is an important capability.
Christopher Thompson