Skip to content

Align wp_is_stream with PHP stream handler internals - #13436

Draft
sirreal wants to merge 6 commits into
WordPress:trunkfrom
sirreal:fix/65870-wp-is-stream-php-parity
Draft

Align wp_is_stream with PHP stream handler internals#13436
sirreal wants to merge 6 commits into
WordPress:trunkfrom
sirreal:fix/65870-wp-is-stream-php-parity

Conversation

@sirreal

@sirreal sirreal commented Sep 8, 2026

Copy link
Copy Markdown
Member

#WIP

Trac ticket:

Use of AI Tools


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

itzmekhokan and others added 6 commits August 13, 2026 19:05
PHP resolves a scheme by looking it up as given, then retrying once with
the scheme lowercased. wp_is_stream() only performed the exact match, so
paths such as `FILE:///path/to/file` were reported as non-streams even
though PHP reads them.

Match the scheme as given, then fall back to a lowercased lookup. The
registered wrappers are not themselves lowercased, so a wrapper
registered as `MyStream` remains unreachable as `mystream`, as in PHP.

Fixes #65870.
Compare wp_is_stream() with invocation of a registered PHP wrapper. Reject one-character schemes and recognize the case-sensitive data: prefix without slashes. Cover case matching, scheme syntax, and wrapper registration state.

Confirmed red/green failures for one-character schemes and data: URLs. See #65870.
Replace numeric dataset keys with descriptions of the URL or path so test output identifies each case.
Keep wp_is_stream() limited to schemes followed by ://, since callers depend on that delimiter. Document the distinction between wrapper selection and opening a resource.

Test built-in data handler case variants separately from replacement-wrapper selection, with PHP and file controls and allow_url_fopen handling. Confirmed the exclusion test fails before removing the special case and passes afterward. See #65870.
Keep the lowercase fallback and direct PHP case-comparison tests. Defer scheme-length changes, data URL recognition, built-in handler tests, and caller work to the dependent follow-up.

The 19 stream tests fail in three cases without case fallback and pass with it. The full functions test file passes: 240 tests, 967 assertions, one skip.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants