Bug #73586 [NEW]: php_user_filter::$stream is not set to the stream the filter is working on.

From: Date: Wed, 23 Nov 2016 07:43:44 +0000
Subject: Bug #73586 [NEW]: php_user_filter::$stream is not set to the stream the filter is working on.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205564@lists.php.net to get a copy of this message
From: sd at jobs dot ch Operating system: Ubuntu PHP version: 7.0.13 Package: Streams related Bug Type: Bug Bug description:php_user_filter::$stream is not set to the stream the filter is working on. 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 bug report at https://bugs.php.net/bug.php?id=73586&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73586&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73586&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73586&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73586&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73586&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73586&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73586&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73586&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73586&r=support Expected behavior: https://bugs.php.net/fix.php?id=73586&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73586&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73586&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73586&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73586&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73586&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73586&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73586&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73586&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73586&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73586&r=mysqlcfg

« previous php.bugs (#205564) next »