|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72941 Modifying bucket->data by-ref has no effect any longer
Submitted: 2016-08-25 12:25 UTC Modified: 2020-09-08 13:12 UTC
From: D0L1K at seznam dot cz Assigned: cmb (profile)
Status: Closed Package: Streams related
PHP Version: 7.0.10 OS: Windows 10
Private report: No CVE-ID: None
 [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

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-10-14 16:25 UTC]
-Package: Class/Object related +Package: Streams related
 [2020-09-08 13:12 UTC]
-Summary: Stream filter passing reference of bucket->data returns nonfiltered stream +Summary: Modifying bucket->data by-ref has no effect any longer -Assigned To: +Assigned To: cmb
 [2020-09-08 13:12 UTC]
I can confirm that change of behavior[1], and assume that just has
been overlooked.  Still, I'm not convinced that we should fix the

[1] <>
 [2020-09-08 13:19 UTC]
The following pull request has been associated:

Patch Name: Fix #72941: Modifying bucket->data by-ref has no effect any longer
On GitHub:
 [2020-09-08 16:12 UTC]
Automatic comment on behalf of
Log: Fix #72941: Modifying bucket-&gt;data by-ref has no effect any longer
 [2020-09-08 16:12 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 04:01:31 2024 UTC