Skip to content

Stdlib: add ext/fileinfo finfo_* MIME sniff (#3366) - #19239

Merged
PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-fileinfo-3366
Jul 15, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-fileinfo-3366

Conversation

@PurHur

@PurHur PurHur commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ext/fileinfo module: FILEINFO_* constants, finfo class, and finfo_open / finfo_file / finfo_buffer / finfo_close / finfo_set_flags
  • PHP-in-PHP MIME sniff via VmFinfo + existing VmMime::detectFromBytes() (no new C runtime); JIT deferred (VM-only v1)
  • Wire Runtime load, spine requires, capability matrix, bootstrap inventory

php-src ref: ext/fileinfo/fileinfo.c, fileinfo.stub.php

Closes #3366

Test plan

  • ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_finfo_mime.php'
  • ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter finfo_mime test/compliance/VMTest.php'
  • ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./script/check-generated-docs.sh'
  • php script/check-selfhost-spine-coverage-sync.php + php script/bootstrap-inventory.php --check

Verification transcript

$ php bin/vm.php test/repro/maintainer_gap_finfo_mime.php
text/x-php
text/x-php
bad_false
text/plain; charset=us-ascii
text/x-php
text/x-php
ok

$ vendor/bin/phpunit --filter finfo_mime test/compliance/VMTest.php
OK (1 test, 1 assertion)

$ ./script/check-generated-docs.sh
check-generated-docs: all generated docs in sync.

Made with Cursor

Register fileinfo module with FILEINFO_* constants, finfo class, and
procedural finfo_open/file/buffer/close/set_flags using VmMime byte sniff
(PHP-in-PHP, VM-first; JIT deferred).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 161c51e into master Jul 15, 2026
1 check failed
@PurHur
PurHur deleted the agent/advanced-stdlib-fileinfo-3366 branch July 15, 2026 17:55
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: ext/fileinfo — finfo_open/finfo_file/mime detection (ext/fileinfo parity)

1 participant