Skip to content

Regression: file_get_contents(php://filter/…) — filter chains return false not transformed body (ext/standard/streams.c) #13741

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

file_get_contents() on php://filter/read=…/resource=… URIs returns false on the VM. Zend applies the registered stream filters and returns the transformed bytes.

URI Zend VM today
php://filter/read=string.toupper/resource=data://text/plain,hello 'HELLO' false
php://filter/read=string.rot13/resource=data://text/plain,uryyb 'hello' false
php://filter/read=convert.quoted-printable-decode/resource=data://text/plain,=48=65=6C=6C=6F 'Hello' false
chained string.tolower|string.toupper 'HELLO' false

stream_filter_append() on an open php://memory handle works; the gap is the php://filter wrapper read path used by file_get_contents().

php-src reference

Repro (verified 2026-06-29)

php test/repro/maintainer_gap_php_filter_read_chain.php
php bin/vm.php test/repro/maintainer_gap_php_filter_read_chain.php

Minimal case:

<?php
echo file_get_contents('php://filter/read=string.toupper/resource=data://text/plain,hello');

Scope (PHP-in-PHP first)

Layer Path
VM stream wrapper registration / file_get_contents path in ext/standard/, reuse existing filter implementations used by stream_filter_append()
Avoid new C filter tables in runtime/ — wire php://filter to existing PHP stream filter stack
Tests test/compliance/cases/stdlib/php_filter_read*.phpt

Done when (php-src-strict)

  • Minimal repro prints HELLO on VM
  • data:// resource target still works
  • Multi-filter chains (a|b) match Zend
  • stream_filter_append() behavior unchanged

Verification

php test/repro/maintainer_gap_php_filter_read_chain.php
php bin/vm.php test/repro/maintainer_gap_php_filter_read_chain.php

Links

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 29, 2026
  2. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issue #13741)

  3. PurHur commented on Jun 29, 2026

    @PurHur
    OwnerAuthor

    Merged in PR #13746. VM + JIT compliance + AOT lint green for php://filter read chain repro (toupper, rot13, quoted-printable-decode, chained filters).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions