|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79424 php_zip_glob uses gl_pathc after call to globfree
Submitted: 2020-03-28 07:58 UTC Modified: -
From: maxcrees at me dot com Assigned:
Status: Closed Package: Zip Related
PHP Version: 7.3Git-2020-03-28 (Git) OS: Linux/musl
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: maxcrees at me dot com
New email:
PHP Version: OS:


 [2020-03-28 07:58 UTC] maxcrees at me dot com
On Linux with the musl libc, globfree zeroes out the gl_pathc field of the given glob_t struct[1]. This breaks the behavior of php_zip_glob (as used by ZipArchive::addGlob) since it calls globfree immediately before using the gl_pathc field of the struct as its return value.

This is addressed by PR #5311. It affects all currently maintained branches of PHP (I believe 7.3, 7.4, and master, since 7.2 is "orange").

It was discovered indirectly by the existing tests ext/zip/tests/bug70103.phpt and ext/zip/tests/bug78641.phpt which resulted in ENOENT upon ZipArchive::close since no entries were added to the archive (gl_pathc == 0).



Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-28 08:14 UTC] maxcrees at me dot com
The following pull request has been associated:

Patch Name: ext/zip: don't use gl_pathc after call to globfree (#79424)
On GitHub:
 [2020-03-29 12:24 UTC]
Automatic comment on behalf of
Log: Fix #79424 ext/zip: don't use gl_pathc after call to globfree
 [2020-03-29 12:24 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 08 09:05:46 2022 UTC