Skip to content

Stdlib: pathinfo() — PATHINFO_ALL must return associative array with dirname/basename/extension/filename (ext/standard/basic_functions.c parity) #4225

Description

@PurHur

Category

stdlib

Problem

pathinfo($path) with default flags (PATHINFO_ALL / 15) must return an associative array with dirname, basename, extension, and filename keys. Zend returns a normal array; this compiler’s VM returns a value for which is_array() is false, so user code cannot read components.

php-src reference

Repro (failure today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro-maintainer/pathinfo_all.php
php bin/vm.php test/repro-maintainer/pathinfo_all.php
'
Runtime Output
Zend 4:/var/www/html:index.php
bin/vm.php not_array

Maintainer probe: single-flag pathinfo($p, PATHINFO_DIRNAME) works; default/all-components form is broken.

Scope (this repo)

  • ext/standard/pathinfo.php — VM return boxing for array results
  • ext/standard/VmString.php — pathinfo() (logic may be fine; return path is suspect)
  • Compliance: test/compliance/cases/stdlib/pathinfo_all.phpt

Done when

  • pathinfo($path) without second arg returns array with 4 string keys on VM/JIT/AOT
  • $r['dirname'] etc. match Zend for sample paths
  • Targeted PHPUnit/compliance green

Related

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 machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions