Skip to content

Regression: stream_filter_append(..., null) coerces to "" — Zend TypeError (ext/standard/streamsfuncs.c) #31408

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Under declare(strict_types=1), stream_filter_append($stream, null) must TypeError on string $filter_name. VM soft-coerces null"" via VmString::coerceStringBuiltinArg, then emits unable to locate filter "" and returns false.

Repro Zend 8.2.32 (2026-08-16) VM (2026-08-16)
declare(strict_types=1); stream_filter_append($h, null) TypeError: stream_filter_append(): Argument #2 ($filter_name) must be of type string, null given Warning: unable to locate filter "" + false

Distinct from closed Reflection param-name drift (#28908) and user-filter LogicException (#14001).

php-src reference

PHP implementation target

  • ext/standard/stream_filter_append.php / stream_filter_prepend.php (same coerce path) — use strict string guard under strict_types (InternalStrictArg / JitStringBuiltinArg peer of trim-family); JitStreamFilter / kernel helpers; no new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_stream_filter_append_null_name.php'
# expect TypeError (match host `php test/repro/maintainer_gap_stream_filter_append_null_name.php`)
<?php
declare(strict_types=1);
$h = fopen('php://memory', 'r+');
stream_filter_append($h, null);

Done when

  • Under strict_types, null $filter_nameTypeError: … Argument #2 ($filter_name) must be of type string, null given (VM + JIT/AOT when in scope)
  • No soft-coerce to "" / unable to locate filter "" for this case
  • Same behavior for stream_filter_prepend if it shares the coerce helper
  • Compliance or unit guard; php-src-strict; no php-compiler-strict shortcut

Activity

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:compilerCompiler / CFG / JITarea:vmVirtual machinebugSomething isn't workingimplementation-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