Bug #73586 [Ver->Csd]: php_user_filter::$stream is not set to the stream the filter is working on.

From: Date: Mon, 28 Nov 2016 09:57:50 +0000
Subject: Bug #73586 [Ver->Csd]: php_user_filter::$stream is not set to the stream the filter is working on.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205671@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73586&edit=1 ID: 73586 Updated by: dmitry@php.net Reported by: sd at jobs dot ch Summary: php_user_filter::$stream is not set to the stream the filter is working on. -Status: Verified +Status: Closed Type: Bug Package: Streams related Operating System: Ubuntu PHP Version: 7.0.13 Assigned To: dmitry Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=9a9ad56af0f80c69d363e8cfabe412da798c497d Log: Fixed bug #73586 (php_user_filter::$stream is not set to the stream the filter is working on). Previous Comments: ------------------------------------------------------------------------ [2016-11-23 23:48:20] cmb@php.net According to git bisect this issue has been introduced with commit 887189ca[1]. Dmitry, can you please have a look at this? <http://git.php.net/?p=php-src.git;a=commit;h=887189ca> ------------------------------------------------------------------------ [2016-11-23 07:43:42] sd at jobs dot ch Description: ------------ In a php_user_filter class the property $stream is not set to the current stream in PHP 7.0.13 (and 7.0.12, 7.0.8) while executing the method filter(). I tried the example script from http://stackoverflow.com/questions/27103269/what-is-a-bucket-brigade It does work in PHP 5.3.29. Test script: --------------- <?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($argv[1], 'rb'); stream_filter_append($fin, 'append', STREAM_FILTER_READ); stream_copy_to_stream($fin, fopen('out', 'wb')); Expected result: ---------------- In PHP 5.3.29 the, on the command line given, input file is copied to the file 'out' and "FooBar \n" is append to the file 'out'. Actual result: -------------- In PHP 7 the given file is just copied (whit out append the string) and error messages like this are produced: PHP Notice: Undefined property: append_filter::$stream in test-filter.php on line 10 PHP Warning: stream_bucket_new(): supplied argument is not a valid stream resource in test-filter.php on line 10 PHP Warning: stream_bucket_append() expects parameter 2 to be object, boolean given in test-filter.php on line 11 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73586&edit=1

« previous php.bugs (#205671) next »