Bug #3456: php core dumps on function call
| From: | kiko at radiumsystems dot com dot br | Date: | Fri, 11 Feb 2000 16:20:03 +0000 |
| Subject: | Bug #3456: php core dumps on function call | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-15379@lists.php.net to get a copy of this message | ||
From: kiko@radiumsystems.com.br
Operating system: Linux-2.2.14
PHP version: 3.0.14
PHP Bug Type: Reproduceable crash
Bug description: php core dumps on function call
I can reproduce this on 3.0.14 as a module and as a standalone cgi. Just run for
extra entertainment. It ocassionally explodes my Netscape too - is apache not too graceful on
handling SEGVs in modules?
<?
function decode_mime_string ($string) {
global $i;
if (eregi("=?([A-Z,0-9,-]+)?([A-Z,0-9,-]+)?([A-Z,0-9,-,=,_]+)?=", $string)) {
if (ereg("^=?", $string)) $str = ' ' . $string;
$coded_strings = explode(' =?', $string);
$counter = 1;
echo "\n\nthis is the string --$string-- and this is $i";
var_dump($coded_strings);
echo "\n\n";
$string = $coded_strings[0]; /* add non encoded text that is before the encoding */
while ($counter < sizeof($coded_strings)) {
$elements = explode('?', $coded_strings[$counter]); /* part 0 = charset */
/* part 1 == encoding */
/* part 2 == encoded part */
/* part 3 == unencoded part beginning with a = */
/* How can we use the charset information? */
if (eregi("Q", $elements[1])) {
$elements[2] = str_replace('_', ' ', $elements[2]);
$elements[2] = eregi_replace("=([A-F,0-9]{2})", "%\\1", $elements[2]);
$string .= urldecode($elements[2]);
} else { /* we should check for B the only valid encoding other then Q
*/
$elements[2] = str_replace('=', '', $elements[2]);
if ($elements[2]) { $string .= base64_decode($elements[2]); }
}
if (isset($elements[3]) && $elements[3] != '') {
$elements[3] = ereg_replace("^=", '', $elements[3]);
$string .= $elements[3];
}
$counter++;
}
}
return $string;
}
for ( $i = 1; $i < 35 ; $i++) {
decode_mime_string("[brain] =?iso-8859-1?B?RWR1Y2Hn428g4CBEaXN04m5jaWE=?=");
}
echo "Done.";
?>