php / php/php-src

file_exists(): open_basedir restriction in effect

Open
#8,402 6 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: Filesystem OS: Windows Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
echo file_exists('C:\Test\test?') ? 'exists' : 'not exists';

Resulted in this output:

PHP Warning:  file_exists(): open_basedir restriction in effect. File(C:\Test\test?) is not within the allowed path(s): (C:\Test) in C:\Test\test.php on line 2
PHP Stack trace:
PHP   1. {main}() C:\Test\test.php:0
PHP   2. file_exists($filename = 'C:\\Test\\test?') C:\Test\test.php:2
not exists

But I expected this output instead:

not exists
PHP Version

PHP 7.4.x, 8.0.x

Operating System

Windows

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the file_exists() example on Windows with open_basedir set to C:\Test, and inspect the PHP interpreter's handling of the path containing ?. Compare the result with the expected output: not exists without an open_basedir warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
backend, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.