Skip to content

Regression: glob('/dir/.*') omits . and .. — Zend matches dot entries (ext/standard/dir.c) #17456

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

glob('/tmp/.*') must return /tmp/. and /tmp/.. on php-src. This compiler's pure-PHP glob (VmFsGlobPure) always skips . / .. before fnmatch(), even when the basename pattern begins with . (explicit dotfile request).

Repro Zend 8.2 (Docker) VM (2026-07-08)
glob('/tmp/.*') ['/tmp/.', '/tmp/..'] []

php-src reference

PHP implementation target

  • ext/standard/VmFsGlobPure.php — only skip ./.. when pattern does not explicitly request dotfiles; share with VmFsGlob.php / JIT FsGlobJitHelper.php

Repro

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

Done when

  • Repro prints ok on VM/JIT/AOT
  • Compliance .phpt under test/compliance/cases/stdlib/
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    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 Jul 8, 2026
  2. PurHur commented on Jul 8, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-c — starting this run

  3. PurHur commented on Jul 8, 2026

    @PurHur
    OwnerAuthor

    Merged via #17459.

    Fix: VmFsGlobPure only skips . / .. (and other dotfiles) when the basename pattern does not start with . — glob('/tmp/.*') now returns /tmp/. and /tmp/.. like php-src ext/standard/dir.c.

    Verification:
    ```
    php bin/vm.php test/repro/maintainer_gap_glob_dot_entries.php → ok
    php vendor/bin/phpunit test/unit/VmFsGlobTest.php --filter testVmFsGlobDotPatternIncludesDotEntries → OK
    php vendor/bin/phpunit test/compliance/ --filter glob_dot_entries → OK (VM+JIT)
    ```

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 machinebugSomething isn't workingenhancementNew 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