|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72941 Stream filter passing reference of bucket->data returns nonfiltered stream
Submitted: 2016-08-25 12:25 UTC Modified: 2016-10-14 16:25 UTC
From: D0L1K at seznam dot cz Assigned:
Status: Open Package: Streams related
PHP Version: 7.0.10 OS: Windows 10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-08-25 12:25 UTC] D0L1K at seznam dot cz
After upgrade PHP from 5.6 to 7.0 the stream_get_contents function with our custom stream filter (php_user_filter) returns non-filtered stream.
After investigations we found that if we pass reference to bucket->data to our decryptor, replace directly char after char (treating string as char array) there and we pass changed bucket object into out brigade, stream_get_contents still returns non-filtered string. Even if we changed bucket->data manually after that chars replace (for ex. bucket->data = "test"), we still get the same output.
But if we pass bucket->data as normal parameter to decryptor, return replaced chars from it and saves them into bucket->data, everything works well.
I've prepared small demonstration of this problem in script using custom filter to rotate left chars in string. In PHP 5.6 it's working normally (output same as it is in "Expected result"), but in 7.0 not.
I looked into 5.6 to 7.0 migration, but didn't see anything related to this problem. Maybe I've missed something, so in that case please just post reference to it and ignore this.

PS: first time reporting bug here, so sorry in case of any mistake or lack of informations. Ofc I will provide any other information if needed

Test script:

Expected result:
ORIGINAL: hello, world
FILTER1:  ello, worldd
FILTER2:  ello, worldd

Actual result:
ORIGINAL: hello, world
FILTER1:  hello, world
FILTER2:  ello, worldd


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-14 16:25 UTC]
-Package: Class/Object related +Package: Streams related
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jul 08 08:01:26 2020 UTC