Skip to content

Regression: SplFileObject::fgetcsv/fputcsv separator ValueError cites fgetcsv() arg #3 — Zend method + arg index (ext/spl/spl_directory.c) #31540

Description

@PurHur

Category

Regression: · php-src-strict · SplFileObject CSV separator ValueError wording

Problem

SplFileObject::fgetcsv('') / fputcsv(..., '') on Zend throw ValueError naming SplFileObject::fgetcsv(): Argument #1 ($separator) / SplFileObject::fputcsv(): Argument #2 ($separator). VM reuses the free-function fgetcsv()/fputcsv() path and cites fgetcsv(): Argument #3 ($separator) / fputcsv(): Argument #3 ($separator).

Probed 2026-08-16 — host Zend PHP 8.2.32 vs php bin/vm.php.

Repro Zend 8.2+ VM (2026-08-16)
$o->fgetcsv('') ValueError: SplFileObject::fgetcsv(): Argument #1 ($separator) must be a single character ValueError: fgetcsv(): Argument #3 ($separator) …
$o->fputcsv(['x'], '') ValueError: SplFileObject::fputcsv(): Argument #2 ($separator) … ValueError: fputcsv(): Argument #3 ($separator) …

php-src reference

  • php/php-src ext/spl/spl_directory.c — SPL_METHOD(SplFileObject, fgetcsv) / fputcsv
  • Free-function wording differs because stream arg shifts indices (php-src ext/standard/file.c)

PHP implementation target

  • ext/spl/ SplFileObject CSV methods — pass method-shaped function name + 1-based arg indices into shared CSV separator guard (do not hardcode free-function fgetcsv/fputcsv labels)
  • PHP-in-PHP; no new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_splfileobject_csv_separator_message.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_splfileobject_csv_separator_message.php'

Done when

  • Empty-separator ValueError text matches Zend for both methods (method name + arg index + $separator)
  • Targeted compliance/PHPUnit 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: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