Re: Re: [SOLVEDish] Re: [PHP] output buffering in CLI script.
| From: | Aschwin Wesselius | Date: | Thu, 28 Feb 2008 13:54:29 +0000 |
| Subject: | Re: Re: [SOLVEDish] Re: [PHP] output buffering in CLI script. | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270555@lists.php.net to get a copy of this message | ||
Nathan Rixham wrote:
how's this?
#!/usr/bin/php
<?php
class trimshebang {
function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = ltrim($bucket->data,"#!/usr/bin/php\n");
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
}
stream_filter_register("trim.shebang", "trimshebang");
include "php://filter/read=trim.shebang/resource=/path/to/include.php";
?>
bit more graceful ;)
Me thinks that when shebang doesn't fit /usr/bin/php (which happens sometimes) you're doomed.....
But it still is a nice example.
--
Aschwin Wesselius
<social>
What you would like to be done to you, do that to the other....
</social>