mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Merge remote-tracking branch 'origin/PHP-5.5' into PHP-5.6
Conflicts: NEWS
This commit is contained in:
commit
666cb333f7
3
NEWS
3
NEWS
@ -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:
|
||||
|
56
ext/standard/tests/streams/stream_multi_filters_close.phpt
Normal file
56
ext/standard/tests/streams/stream_multi_filters_close.phpt
Normal 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)
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user