Wez,

  After our short discussion in IRC today I decided to try and put together
a simple implementation of that filter wrapper.  What I came up with can be
seen here: http://frankenbox.alphaweb.net/test/php.filter.diff.txt but it's
not something I'm suggesting be commited, just a quick exercise to open my
brain to thinking about implications... There's also the fact it's working
on the current single filter chain model rather than the asymetric filter
chains you've got planned.

  Now, the point I've managed to completely skirt around.... I discovered
something a little disturbing about the http wrapper (and presumably other
network wrappers as well).  The following script (with or without the above
patch applied) will *NOT* uppercase the content retrieved from the url
because the content is read into buffer immediately (on the fopen call) and
the filter isn't applied until the next line.

<?php
  $fp = fopen("http://www.php.net/";, "r");
  /* the data is already sitting in buffer */
  stream_filter_append($fp, "string.toupper");
  while ($str = fgets($fp))
    print $str;
  fclose($fp);
?>

  Presumably you're aware of this?

-Pollita



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to