php.net |  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
Description:
------------
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:
---------------
https://mega.nz/#!4VtiwCYB!vrxnr99hj6940uXYXUWAjPHrpcyqscyJjNN7iIkyBVs

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

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-14 16:25 UTC] cmb@php.net
-Package: Class/Object related +Package: Streams related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 21:01:28 2019 UTC