Repository navigation
Conversation
Flushing closed the archive stream while a handle on a deleted entry still referenced it. The open handle check now covers deleted entries.
iliaal
left a comment
There was a problem hiding this comment.
Please address the three inline comments.
| break; | ||
| } | ||
| } | ||
| if (entry->is_deleted || entry->is_mounted) { |
There was a problem hiding this comment.
Two readers can share the old archive stream. phar_entry_delref() closes it when the first reader closes, even if the second still holds it. Can we track references to the backing stream and close it on the last release?
| } else { | ||
| if (entry->fp_refcount) { | ||
| if (entry->fp_type == PHAR_FP) { | ||
| fp->free_fp = 0; |
There was a problem hiding this comment.
On the next flush, the reader still holds the original stream, but this clears free_fp for its replacement too. Each later flush can leave another descriptor open until request shutdown. Can we retain only the stream the reader holds?
| var_dump(fread($fp, 4)); | ||
| var_dump(fclose($fp)); | ||
| var_dump(isset($phar['b'])); | ||
| var_dump($phar['a']->getContent()); |
There was a problem hiding this comment.
Can we reopen the ZIP in a fresh process here? This test passes, but PharData rejects the saved archive. The central directory declares two entries and contains only a. The writer already had this counting bug.
Flushing closed the archive stream while a handle on a deleted entry still referenced it. The open handle check now covers deleted entries.