Bug #72941 [PATCH]: Modifying bucket->data by-ref has no effect any longer
Edit report at https://bugs.php.net/bug.php?id=72941&edit=1
ID: 72941
Patch added by: cmb@php.net
Reported by: D0L1K at seznam dot cz
Summary: Modifying bucket->data by-ref has no effect any
longer
Status: Assigned
Type: Bug
Package: Streams related
Operating System: Windows 10
PHP Version: 7.0.10
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fix #72941: Modifying bucket->data by-ref has no effect any longer
On GitHub: https://github.com/php/php-src/pull/6096
Patch: https://github.com/php/php-src/pull/6096.patch
Previous Comments:
------------------------------------------------------------------------
[2020-09-08 13:12:53] cmb@php.net
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
regression.
[1] <https://3v4l.org/lQ88Q>
------------------------------------------------------------------------
[2016-08-25 12:25:49] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72941&edit=1
Thread (4 messages)