|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
45 + 43 = ?
Subscribe to this entry?

 [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 20:03:43 2022 UTC