Skip to content

[pull] master from php:master#1013

Merged
pull[bot] merged 9 commits into
turkdevops:masterfrom
php:master
Jun 18, 2026
Merged

[pull] master from php:master#1013
pull[bot] merged 9 commits into
turkdevops:masterfrom
php:master

Conversation

@pull

@pull pull Bot commented Jun 18, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

LamentXU123 and others added 9 commits June 18, 2026 22:44
Similar to #21942 and #21871. The dl function in std extension now silently truncates
from NUL bytes. Now we reject any parameter containing NUL byte(s) by throwing a 
ValueErrpr
Validate each ZIP extra field header before consuming its payload. The old
parser kept the remaining extra field length in a uint16_t and subtracted the
declared payload size plus the header size without first checking that the
field fit inside the remaining extra data.

A malformed ZIP central directory entry could therefore underflow the counter
and make the parser continue into following bytes, such as the file comment.
That allowed comment bytes to be interpreted as another extra field and update
metadata like the entry mtime.

Reject truncated extra headers and oversized payloads, keep the remaining
length in size_t while parsing, and check seeks that skip unknown or unused
field data. Add a regression test that builds a malformed ZIP and expects
PharData to reject it.

Closes #22330
* PHP-8.4:
  ext/phar: Fix ZIP extra field length underflow (#22330)
…22357)

This is in order to remove usage of HASH_OF() and interpreting objects as arrays within PHP

As this is a new parameter, there is no BC break.
* PHP-8.5:
  ext/phar: Fix ZIP extra field length underflow (#22330)
Several memory-safety issues in the new Io\Poll API, found by review and
confirmed under valgrind:

- Watcher kept a raw pointer to its Context's php_poll_ctx with no
  reference, so dropping the Context while holding a Watcher left
  remove()/modify() dereferencing freed memory (use-after-free). The
  Context now neutralizes its watchers (active=false, poll_ctx=NULL)
  before it is destroyed, so those calls throw InactiveWatcherException.
- StreamPollHandle took a reference on the stream resource in the
  constructor but never released it, leaking the descriptor for the
  rest of the request. Store the zend_resource and release it in the
  handle cleanup; the php_stream may already be freed by then (e.g.
  the user closed it), so the cleanup must not dereference it.
- Watcher and Context had no get_gc handler, so reference cycles through
  Watcher::$data were uncollectable. Add get_gc for both.
- Context, Watcher and StreamPollHandle were cloneable through the
  default handler, which shallow-copied the backing php_poll_ctx and the
  watcher map by pointer and double-freed them on destruction. Mark all
  three uncloneable.
- Calling __construct() a second time on a Context or StreamPollHandle
  replaced the backing context or handle data without releasing the
  first, leaking it. Throw if the object is already constructed.
- The add(), modify(), remove() and wait() entry points accepted a NULL
  ctx and forwarded it to php_poll_set_error(), which dereferenced it.
  The userland layer already gates on an active context before reaching
  the C API, so assert a non-NULL ctx in those entry points instead.

Closes GH-22316
/* */ comments are ignored by the stub parser.
@pull pull Bot locked and limited conversation to collaborators Jun 18, 2026
@pull pull Bot added the ⤵️ pull label Jun 18, 2026
@pull pull Bot merged commit 6e989d2 into turkdevops:master Jun 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants