Bug #74512 [Nab]: file_get_contents fails on zlib compressed stream

From: Date: Wed, 03 May 2017 05:42:21 +0000
Subject: Bug #74512 [Nab]: file_get_contents fails on zlib compressed stream
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208924@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74512&edit=1

 ID:                 74512
 User updated by:    wellu at wellu dot org
 Reported by:        wellu at wellu dot org
 Summary:            file_get_contents fails on zlib compressed stream
 Status:             Not a bug
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Ubuntu 16.04.2 LTS
 PHP Version:        7.0.18
 Block user comment: N
 Private report:     N

 New Comment:

Just out of curiosity: is / was this breaking change in file_get_contents officially documented
somewhere?


Previous Comments:
------------------------------------------------------------------------
[2017-05-02 10:45:49] wellu at wellu dot org

Ok, sorted this one out. Apparently in 5.6 you can't use file_get_contents anymore like in the
past.

https://secure.phabricator.com/rP42566379dc3c4fd01a73067215da4a7ca18f9c17

------------------------------------------------------------------------
[2017-04-28 18:57:20] wellu at wellu dot org

Description:
------------
Exact PHP version: PHP 7.0.15-0ubuntu0.16.04.4 (this was not selectable in dropdown?)

I'm posting raw JSON data to a webserver that is gzipped. Server code is:

$input_data = json_decode(trim(file_get_contents("compress.zlib://php://input")), true);

which should read whatever is posted, then deflate it and then turn it in to an object.

This exact code used to work in Ubuntu 14.04 which had PHP 5.x something but now I'm getting:

ERROR - 2017-04-28 13:41:42 --> Severity: Warning  -->
file_get_contents(compress.zlib://php://input): failed to open stream: operation failed
/srv/www/xxx/xxx.php 51
ERROR - 2017-04-28 13:42:19 --> Severity: Warning  --> file_get_contents(): cannot represent a
stream of type Input as a File Descriptor

which points to the line in the beginning of this bug report. Nothing changed in the client but
upgrading from 5.x to 7.x broke this.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74512&edit=1


Thread (4 messages)

« previous php.bugs (#208924) next »