PHP 4.0 Bug #8746: Crash on comparing GLOBALS Variabel
| From: | korenhof at planet dot nl | Date: | Tue, 16 Jan 2001 20:45:24 +0000 |
| Subject: | PHP 4.0 Bug #8746: Crash on comparing GLOBALS Variabel | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-44278@lists.php.net to get a copy of this message | ||
From: korenhof@planet.nl
Operating system: Win 2000
PHP version: 4.0.4
PHP Bug Type: Reproduceable crash
Bug description: Crash on comparing GLOBALS Variabel
I installed php 4.04 just as is. No settings are changed.
I fill the globals varibel with these functions:
-------------
function ReadSettingsFile($filename){
if (file_exists($filename)){
$FileContest = file ($filename);
while (list ($line_num, $line) = each ($FileContest)) {
$line = ereg_replace("[\n\r]", "", $line);
list ($name, $value) = split("=", $line);
if ($name != null && $value != null){
$GLOBALS[$name] = $value;
}
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
function ReadSetFile($filename){
if (file_exists($filename)){
$FileContest = split("\n", pack("H*", join("", file
('./'. $filename))));
while (list ($line_num, $line) = each ($FileContest)) {
$line = ereg_replace("[\n\r]", "", $line);
list ($name, $value) = split("=", $line);
if ($name != null && $value != null){
$GLOBALS[$name] = $value;
}
}
}
}
-------------
When I run this peas of script later in the program the program terminates:
-------------
while(ereg ("%%([^%\/]*)%%", $workingtemplate, $name)){
if ($tempinput{$name[1]} != null){
$workingtemplate = ereg_replace("%%$name[1]%%", $tempinput{$name[1]},
$workingtemplate);
}elseif($HTTP_ENV_VARS{$name[1]} != null){
$workingtemplate = ereg_replace("%%$name[1]%%", $HTTP_ENV_VARS{$name[1]},
$workingtemplate);
}elseif($GLOBALS[$name[1]] != null){
$workingtemplate = ereg_replace("%%$name[1]%%", $GLOBALS[$name[1]], $workingtemplate);
}else{
$workingtemplate = ereg_replace("%%$name[1]%%", "", $workingtemplate);
}
}
-------------
When I comment these lines, the script won;t crash:
//}elseif($GLOBALS[$name[1]] != null){
//$workingtemplate = ereg_replace("%%$name[1]%%", $GLOBALS[$name[1]], $workingtemplate);
-------------
It seams like the global variable is to big or something like that. But when I don't fill the
variables at the top the program still terminates. Then I get a DrWatson Like error but then the win
2000 way. I also use MySQL. Closing MySQL didn't help eather. I restart didn't bother
eather.
If there are any questions please let me know.
thx,
Sebas
--
Edit Bug report at: http://bugs.php.net/?id=8746&edit=1