php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72686 zlib: url support is broken, that may be a good thing
Submitted: 2016-07-27 02:45 UTC Modified: 2016-07-27 04:45 UTC
From: ekobrin at akamai dot com Assigned: pierrick (profile)
Status: Closed Package: Streams related
PHP Version: master-Git-2016-07-27 (Git) OS:
Private report: No CVE-ID: None
 [2016-07-27 02:45 UTC] ekobrin at akamai dot com
Description:
------------
Line 1772 of streams.c is: '} else if (n == 5 && strncasecmp(path, "zlib:", 5) == 0) '

This is a bug.

If path starts with "zlib:" then n will be 4, not 5.

Since this branch can never be entered, and it only exists to support a deprecated stream type, I suggest simple deleting the entire "else" clause.

Test script:
---------------
readfile("zlib:file.gz");

Expected result:
----------------
gzip content is extracted, warning (Use of "zlib:" wrapper is deprecated; please use "compress.zlib://" instead) is printed

Actual result:
--------------
Warning (failed to open stream: No such file or directory) is printed

Patches

remove-broken-zlib-urls (last revision 2016-07-27 02:45 UTC by ekobrin at akamai dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-27 04:41 UTC] pierrick@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=074b86d8451365c81d3ae76616fb4df1757ddc1f
Log: Fixed bug #72686 (zlib: url support is broken).
 [2016-07-27 04:41 UTC] pierrick@php.net
-Status: Open +Status: Closed
 [2016-07-27 04:45 UTC] pierrick@php.net
-Assigned To: +Assigned To: pierrick
 [2016-07-27 04:45 UTC] pierrick@php.net
Thanks for the bug and the patch. Bug was introduced before 5.2.0 so I just removed the dead code as you suggested.
 [2016-10-17 10:10 UTC] bwoebi@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=074b86d8451365c81d3ae76616fb4df1757ddc1f
Log: Fixed bug #72686 (zlib: url support is broken).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 09:01:28 2024 UTC