Skip to content

Stdlib: set_include_path('') / set_include_path(false) — accepts invalid path, Zend returns false (ext/standard/dir.c) #12165

Closed

Description

@PurHur

Summary

set_include_path() with an empty string or false must return false and leave the include path unchanged (Zend/php-src). This compiler accepts the value, returns the previous path string, and mutates get_include_path().

Repro

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

Zend (expected) for set_include_path(''):

  • return: false
  • get_include_path() unchanged

VM (today):

  • return: previous path (e.g. '.:/usr/share/php')
  • get_include_path() becomes ''

Same pattern for set_include_path(false).

php-src reference

  • ext/standard/dir.c — PHP_MINIT_FUNCTION / zif_set_include_path validation of path argument

Implementation (PHP-in-PHP)

  • Validate argument in ext/standard/set_include_path.php + VmString/VmFs helper; reject empty/non-string per php-src.
  • Register parity in capability matrix if needed.

Done when (php-src-strict)

  • set_include_path('') → false, path unchanged
  • set_include_path(false) → false, path unchanged
  • Valid path still returns previous path string
  • Targeted compliance/repro guard

Refs #1492

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 26, 2026
  2. PurHur commented on Jun 26, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — batch (issues #12165, #12164)

  3. PurHur commented on Jun 26, 2026

    @PurHur
    OwnerAuthor

    Merged via #12174.

    Verification: VM + JIT repro green; compliance set_include_path_invalid_jit.phpt passes VM/JIT/AOT (3/3). set_include_path('') / set_include_path(false) → false, path unchanged.

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