Re: HALT Patch
| From: | John Coggeshall | Date: | Sat, 12 Mar 2005 12:19:13 +0000 |
| Subject: | Re: HALT Patch | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-15397@lists.php.net to get a copy of this message | ||
I think the lexer patch is good enough.
John
On Sat, 2005-03-12 at 06:58, Christian Schneider wrote:
> Moriyoshi Koizumi wrote:
> > I modified your patch so it can capture the position where the
> > supposed data begins into the constant __HALT_PHP_PARSER__.
>
> Sounds like a good idea to me as all the manual work to guess the start
> of the data look a bit kludgy to me.
>
> > <?php
> > $fp = fopen(__FILE__, 'rb');
> > fseek($fp, __HALT_PHP_PARSER__, SEEK_SET);
> > fpassthru($fp);
> > ?>
> > <?php __HALT_PHP_PARSER__; ?>
> > abc
> > def
>
> Hmm.. I was wondering if we should go one step further and also provide
> a stream to the data. If the most common usage of this construct is
> going to be reading the data after __HALT_PHP_PARSER__ then we should
> optimize for that case. Something like
>
> <?php
> $data = gzdeflate(file_get_contents("php://data"));
> ?>
> <?php __DATA__; ?>
> ...
>
> - Chris