mirror of
https://github.com/php/php-src.git
synced 2026-04-01 05:02:27 +02:00
Merge branch 'PHP-7.1'
* PHP-7.1: Fixed bug #73586 (php_user_filter::$stream is not set to the stream the filter is working on).
This commit is contained in:
@@ -330,6 +330,16 @@ static zend_always_inline zval *zend_hash_str_find_ind(const HashTable *ht, cons
|
||||
}
|
||||
|
||||
|
||||
static zend_always_inline int zend_hash_str_exists_ind(const HashTable *ht, const char *str, size_t len)
|
||||
{
|
||||
zval *zv;
|
||||
|
||||
zv = zend_hash_str_find(ht, str, len);
|
||||
return zv && (Z_TYPE_P(zv) != IS_INDIRECT ||
|
||||
Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF);
|
||||
}
|
||||
|
||||
|
||||
static zend_always_inline zval *zend_symtable_update(HashTable *ht, zend_string *key, zval *pData)
|
||||
{
|
||||
zend_ulong idx;
|
||||
|
||||
45
ext/standard/tests/filters/bug73586.phpt
Normal file
45
ext/standard/tests/filters/bug73586.phpt
Normal file
@@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
Bug #73586 (php_user_filter::$stream is not set to the stream the filter is working on).
|
||||
--FILE--
|
||||
<?php
|
||||
class append_filter extends php_user_filter {
|
||||
public $stream;
|
||||
function filter($in, $out, &$consumed, $closing) {
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
$consumed += $bucket->datalen;
|
||||
stream_bucket_append($out, $bucket);
|
||||
}
|
||||
if ($closing) {
|
||||
$bucket = stream_bucket_new($this->stream, "FooBar\n");
|
||||
stream_bucket_append($out, $bucket);
|
||||
}
|
||||
return PSFS_PASS_ON;
|
||||
}
|
||||
}
|
||||
stream_filter_register("append", "append_filter");
|
||||
$fin = fopen(__FILE__, 'rb');
|
||||
stream_filter_append($fin, 'append', STREAM_FILTER_READ);
|
||||
stream_copy_to_stream($fin, STDOUT);
|
||||
?>
|
||||
--EXPECT--
|
||||
<?php
|
||||
class append_filter extends php_user_filter {
|
||||
public $stream;
|
||||
function filter($in, $out, &$consumed, $closing) {
|
||||
while ($bucket = stream_bucket_make_writeable($in)) {
|
||||
$consumed += $bucket->datalen;
|
||||
stream_bucket_append($out, $bucket);
|
||||
}
|
||||
if ($closing) {
|
||||
$bucket = stream_bucket_new($this->stream, "FooBar\n");
|
||||
stream_bucket_append($out, $bucket);
|
||||
}
|
||||
return PSFS_PASS_ON;
|
||||
}
|
||||
}
|
||||
stream_filter_register("append", "append_filter");
|
||||
$fin = fopen(__FILE__, 'rb');
|
||||
stream_filter_append($fin, 'append', STREAM_FILTER_READ);
|
||||
stream_copy_to_stream($fin, STDOUT);
|
||||
?>
|
||||
FooBar
|
||||
@@ -175,7 +175,7 @@ php_stream_filter_status_t userfilter_filter(
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!zend_hash_str_exists(Z_OBJPROP_P(obj), "stream", sizeof("stream")-1)) {
|
||||
if (!zend_hash_str_exists_ind(Z_OBJPROP_P(obj), "stream", sizeof("stream")-1)) {
|
||||
zval tmp;
|
||||
|
||||
/* Give the userfilter class a hook back to the stream */
|
||||
|
||||
Reference in New Issue
Block a user