Skip to content

Commit

Permalink
The filter method may be called multiple times, so skip status needs …
Browse files Browse the repository at this point in the history
…to be global
  • Loading branch information
slusarz committed Oct 28, 2014
1 parent f8cd212 commit 856fd58
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -23,6 +23,13 @@
*/
class Horde_Imap_Client_Data_Format_Filter_String extends php_user_filter
{
/**
* Skip status.
*
* @var boolean
*/
protected $_skip = false;

/**
* @see stream_filter_register()
*/
Expand All @@ -43,10 +50,9 @@ public function onCreate()
public function filter($in, $out, &$consumed, $closing)
{
$p = $this->params;
$skip = false;

while ($bucket = stream_bucket_make_writeable($in)) {
if (!$skip) {
if (!$this->_skip) {
$len = $bucket->datalen;
$str = $bucket->data;

Expand All @@ -59,7 +65,7 @@ public function filter($in, $out, &$consumed, $closing)
$p->literal = true;

// No need to scan input anymore.
$skip = true;
$this->_skip = true;
break 2;

case 10: // LF
Expand Down

0 comments on commit 856fd58

Please sign in to comment.