Skip to content

Stdlib: fputcsv() CSV option ValueError parity (#4530) - #7755

Merged
PurHur merged 1 commit into
masterfrom
agent/stdlib-fputcsv-4530
Jun 9, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/stdlib-fputcsv-4530

Conversation

@PurHur

@PurHur PurHur commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add VmCsvArg / JitCsvArg PHP validation for fputcsv() separator, enclosure, and escape arguments matching php-src ext/standard/file.c (PHP_FUNCTION(fputcsv) / php_csv_handle_escape_argument).
  • VM path validates before VmFs::fputcsv() instead of relying on host \fputcsv() delegation.
  • JIT/AOT path emits compile-time and runtime ValueError for invalid option strings.

php-src reference

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter fputcsv'
# OK (11 tests, 13 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro-maintainer/fputcsv_escape.php'
# enclosure empty / escape two → ValueError matching Zend

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/compile.php -l test/fixtures/aot/compile-only/fputcsv_escape.php'
# lint_exit=0

Closes #4530

Made with Cursor

Add explicit PHP validation for separator/enclosure/escape instead of relying on host fputcsv delegation, matching php-src ext/standard/file.c.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 3f6bdae into master Jun 9, 2026
@PurHur
PurHur deleted the agent/stdlib-fputcsv-4530 branch June 9, 2026 05:19
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.

Stdlib: fputcsv() — enclosure/escape edge cases + ValueError parity (ext/standard/file.c)

1 participant