Skip to content

Stdlib: stream_filter_append()/stream_filter_prepend() user filters not supported (LogicException) #14001

Description

@PurHur

Repro (php-src-strict)

<?php
class UppercaseFilter extends php_user_filter {
    public function filter($in, $out, &$consumed, $closing) {
        while ($bucket = stream_bucket_make_writeable($in)) {
            $bucket->data = strtoupper($bucket->data);
            $consumed += $bucket->datalen;
            stream_bucket_append($out, $bucket);
        }
        return PSFS_PASS_ON;
    }
}

stream_filter_register('uppercase', UppercaseFilter::class);
$fp = fopen('php://temp', 'w+');
stream_filter_append($fp, 'uppercase');
fwrite($fp, "hello\n");
rewind($fp);
echo stream_get_contents($fp);

Zend expected

  • Output: HELLO (plus newline)

php-compiler current

  • Throws LogicException like:
    • stream_filter_append(): user filter "uppercase" is not implemented in this compiler build

php-src reference

  • ext/standard/streamsfuncs.c (stream_filter_append / stream_filter_prepend)
  • main/streams/filter.c (user filter plumbing)

Done when

  • VM can run the repro and print HELLO.
  • Add a compliance test under test/compliance/ covering user filter registration + append/prepend.

Activity

  1. added
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 30, 2026
  2. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — batch (issue #14001)

  3. PurHur commented on Jun 30, 2026

    @PurHur
    OwnerAuthor

    Merged via #14041.

    Verification:

    php bin/vm.php test/repro/maintainer_gap_stream_user_filter_uppercase.php  # HELLO
    vendor/bin/phpunit --filter stream_user_filter_append  # OK (2 tests)
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

    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions