Skip to content

Stdlib: pathinfo() PATHINFO_* named flag constants rejected — LogicException not basename/filename (ext/standard/basic_functions.c) #9565

Description

@PurHur

Category

stdlib · php-src-strict

Problem

pathinfo() second argument cannot accept PATHINFO_* named constants—the VM throws LogicException: pathinfo() flags must be an integer in this compiler build instead of returning the selected component.

Call Zend VM today
pathinfo('/foo/bar/baz.txt', PATHINFO_FILENAME) 'baz' LogicException
pathinfo('/foo/bar/baz.txt', PATHINFO_EXTENSION) 'txt' LogicException
pathinfo('/foo/bar/baz.txt', PATHINFO_BASENAME) 'baz.txt' LogicException

Integer flag values work when written literally; named constants are not lowered to their integer values at the builtin boundary.

php-src reference

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_pathinfo_pathinfo_filename.php'
php bin/vm.php test/repro/maintainer_gap_pathinfo_pathinfo_filename.php

Implementation hints (PHP-in-PHP)

Done when

  • Repro script matches Zend on all three lines
  • No LogicException for PATHINFO_FILENAME et al.
  • Compliance guard added
  • JIT/AOT pathinfo flags agree

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 appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions