Re: Bug #854: include() problem
| From: | Marc Mu�oz Salvador | Date: | Mon, 19 Oct 1998 08:04:20 +0000 |
| Subject: | Re: Bug #854: include() problem | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-1907@lists.php.net to get a copy of this message | ||
matt@debris.com wrote:
> From: matt@debris.com
> Operating system: BSDI 3.0
> PHP version: 3.0.5
> PHP Bug Type: Reproduceable crash
> Bug description: include() problem
>
> When an included module is called multiple times, its
> variable space can become corrupt. Perhaps include()
> was never intended to be used in this fashion, but it
> crashes in any case.
>
> Here's a fresh backtrace:
> Program terminated with signal 11, Segmentation fault.
> #0 pval_destructor (pvalue=0x0) at variables.c:76
> 76 if (pvalue->type == IS_STRING) {
> (gdb) bt
> #0 pval_destructor (pvalue=0x0) at variables.c:76
> #1 0x2480e in tc_destroy (tc=0xd2a604) at token_cache.c:314
> #2 0x2484e in tcm_destroy (tcm=0xa870c) at token_cache.c:328
> #3 0x1dc66 in php3_request_shutdown (dummy=0x0) at main.c:728
> #4 0x1fc35 in main (argc=3, argv=0xefbfdac0) at main.c:1790
>
> Here's a script that crashes PHP:
> #!/usr/local/bin/php3 -q
> <?
> for ($i = 0; $i < 1550; $i++) {
> include ("crasher.html");
> }
> ?>
>
> crasher.html:
> <?
> $text = "***************************************************************";
> $text .= "***************************************************************\n";
> $text .= "***************************************************************\n";
> $text .= "***************************************************************\n";
> ## etc... put in about a dozen or 20 of these lines...
> ## just build a long string, one way or another.
> ?>
>
> When I move the contents of crasher.html into the
> loop, replacing the include() call, the script works
> fine. Something is different about the way PHP treats
> the variable space of included code.
>
> Adding unset($text) to the end of the included module does not help.
>
> --
> PHP Development Mailing List http://www.php.net/
> To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
> For help: php-dev-help@lists.php.net
Hi, this is Marc from Barcelona:
I've thought about your problem and I'll explain what I do:
includedfile.h
<?
$text = "***************************************************************";
$text .= "***************************************************************\n";
$text .= "***************************************************************\n";
$text .= "***************************************************************\n";
?>
and the script:
<? include ("includedfile.h");
for ($i = 0; $i < 1550; $i++) {
echo $text;
}
?>
I don't know if it helps you, but, with this you don't use the include inside
the loop.
Regards,
Marc Muñoz
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net