php / php/php-src

Add stream context metadata options for compress.zlib:// protocol wrapper so that original mtime and name can be given

Open
#10,222 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Category: Streams Extension: zlib Feature
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

Currently, when writing to a gz file using the compress.zlib:// protocol wrapper it is not possible to pass the mtime or name of the original file. It would be nice if we could do so without having to reopen the gzip file in write mode for write the metadata directly into it as in this bug report https://bugs.php.net/bug.php?id=46577
I believe that this can be done by adding new stream context options for zlib (similar to those for phar). See https://www.php.net/manual/en/context.php

The gzip file format supports the following meta data:

  • compression method
  • itype (text or binary)
  • mtime (nice to have)
  • size (thankfully set by compress.zlib:// )
  • os
  • original file name (nice to have)
  • comment

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the compress.zlib:// protocol wrapper and its stream context option handling, then compare the existing phar context options referenced in the issue. Determine how mtime and original file name should be passed into gzip metadata, and verify that writing through the wrapper preserves both values without reopening the file.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.