PHP 4.0 Bug #7131 Updated: Undocumented change in behaviour of alternate syntax
| From: | Bug Database | Date: | Wed, 11 Oct 2000 11:07:04 +0000 |
| Subject: | PHP 4.0 Bug #7131 Updated: Undocumented change in behaviour of alternate syntax | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34657@lists.php.net to get a copy of this message | ||
ID: 7131
Updated by: hholzgra
Reported By: diego@otello.alma.unibo.it
Status: Closed
Bug Type: *General Issues
Assigned To:
Comments:
the scope of a control structure is limited to single files
in php 4 due to compiling reasons
you may include or require files within if statements
or loops but all of the control structures elements
( if-else-endif , for-endfor ) have to be in a single
compile unit (file or eval() string)
this is documented somehow in
http://www.php.net/version4/incompatibilities.php,
topic #2
Previous Comments:
---------------------------------------------------------------------------
[2000-10-11 05:37:20] diego@otello.alma.unibo.it
This used to work with PHP3 and stopped when I upgraded to PHP4. Seems that require() doesen't
support opening a block in the included file an closing it in the block that contains the require()
itself. Maybe a short example could explain it better...
In test.inc :
<?php
if(1):
?>
ABC
In test.php3 :
><?php
require("test.inc");
echo "Test OK";
endif;
?>
With php3 it worked ("ABC Test OK"), with php4 it stops with parse error on last line of
test.inc (sure it doesen't find the expected endif...)
BYtE,
Diego.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7131