Merge remote-tracking branch 'origin/PHP-5.5' into PHP-5.6

Conflicts:
	NEWS
This commit is contained in:
Bob Weinand 2015-01-26 22:51:37 +01:00
commit 666cb333f7
3 changed files with 60 additions and 1 deletions

3
NEWS
View File

@ -34,6 +34,9 @@
. Fixed bug #68657 (Reading 4 byte floats with Mysqli and libmysqlclient
has rounding errors) (Keyur Govande)
- Streams:
. Fixed bug which caused call after final close on streams filter. (Bob)
22 Jan 2015, PHP 5.6.5
- Core:

View File

@ -0,0 +1,56 @@
--TEST--
Check if multiple filters are closed correctly and never called again after close
--FILE--
<?php
class FirstFilter extends php_user_filter {
public function filter($in, $out, &$consumed, $closing) {
static $closed = 0;
while ($bucket = stream_bucket_make_writeable($in)) {
stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data));
}
if ($closing) {
$closed++;
}
if ($closed > 0) {
var_dump($closed++);
}
return PSFS_PASS_ON;
}
}
class SecondFilter extends php_user_filter {
public function filter($in, $out, &$consumed, $closing) {
static $closed = 0;
while ($bucket = stream_bucket_make_writeable($in)) {
stream_bucket_append($out, stream_bucket_new($this->stream, $bucket->data));
}
if ($closing) {
$closed++;
}
if ($closed > 0) {
var_dump($closed++);
}
return PSFS_PASS_ON;
}
}
$r = fopen("php://stdout", "w+");
stream_filter_register("first", "FirstFilter");
stream_filter_register("second", "SecondFilter");
$first = stream_filter_prepend($r, "first", STREAM_FILTER_WRITE, []);
$second = stream_filter_prepend($r, "second", STREAM_FILTER_WRITE, []);
fwrite($r, "test\n");
stream_filter_remove($second);
stream_filter_remove($first);
?>
--EXPECT--
test
int(1)
int(1)

View File

@ -449,7 +449,7 @@ PHPAPI int _php_stream_filter_flush(php_stream_filter *filter, int finish TSRMLS
for(current = filter; current; current = current->next) {
php_stream_filter_status_t status;
status = filter->fops->filter(stream, filter, inp, outp, NULL, flags TSRMLS_CC);
status = filter->fops->filter(stream, current, inp, outp, NULL, flags TSRMLS_CC);
if (status == PSFS_FEED_ME) {
/* We've flushed the data far enough */
return SUCCESS;