BC problem
| From: | Markus Fischer | Date: | Wed, 28 Nov 2001 17:05:39 +0000 |
| Subject: | BC problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-71941@lists.php.net to get a copy of this message | ||
A small example which shows that BC seems to be broken for a
certain (but not uncommon) case:
cat include_me.php
<?
if (!defined('I_AM_INCLUDED')) {
define('I_AM_INCLUDED', 1);
} else {
echo "returning<br>\n";
return;
}
function cant_be_redefined() {
}
?>
cat include_it.php
<?
echo "1<br>\n";
include 'include_me.php';
echo "2<br>\n";
include 'include_me.php';
echo "3<br>\n";
?>
Now run include_it.php (it doesn't matter if its CGI or
module):
On PHP 4.0.4pl1 up to 4.0.6 this gives:
1<br>
2<br>
returning<br>
3<br>
But now I get:
1<br>
2<br>
<br />
Fatal error - Cannot redeclare cant_be_redefined()
(previously declared in include_me.php:9)
[I shortened the error message to be more readable]
If this is 'now the way it is' this should be mentioned
somewhere very clearly I think. Doesn't seem to be fixable in
some way? Couldn't find a reference to it e.g. in the NEWS
file.
I know that there should be used include_once() but
I'm talking about existing code writing that way which
definitely won't work without modifications.
- Markus
ps: thanks to Jan for verifying this!
--
Please always Cc to me when replying to me on the lists.