Bug #72941 [NEW]: Stream filter passing reference of bucket->data returns nonfiltered stream

From: Date: Thu, 25 Aug 2016 12:25:52 +0000
Subject: Bug #72941 [NEW]: Stream filter passing reference of bucket->data returns nonfiltered stream
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203542@lists.php.net to get a copy of this message
From:             D0L1K at seznam dot cz
Operating system: Windows 10
PHP version:      7.0.10
Package:          Class/Object related
Bug Type:         Bug
Bug description:Stream filter passing reference of bucket->data returns nonfiltered stream

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 bug report at https://bugs.php.net/bug.php?id=72941&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=72941&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=72941&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=72941&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=72941&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=72941&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=72941&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=72941&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=72941&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=72941&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=72941&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=72941&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=72941&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=72941&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72941&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=72941&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=72941&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=72941&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72941&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=72941&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=72941&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#203542) next »