|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28355 glob wont error if dir is not readable
Submitted: 2004-05-11 01:31 UTC Modified: 2005-06-12 02:55 UTC
From: trancer at trancer dot nl Assigned: hholzgra (profile)
Status: Not a bug Package: Directory function related
PHP Version: 4.3.6 OS: Linux
Private report: No CVE-ID: None
 [2004-05-11 01:31 UTC] trancer at trancer dot nl
If the dir isnt readable by the webserver (apache in my case) glob() wont list a thing. Glob wont return an error like 'permission denied' though alike other functions do.

It would be nice to see that when glob() cant read the directory it will return an error or a notice. 

Reproduce code:

The dir in which the png file was, was chmodded to 711 so apache only had execution rights.

Expected result:
Warning: permission denied .... 
Array( )

Actual result:
Array( )


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-12 02:55 UTC]
The C library implementation of glob() does not distinguish between
empty and non-readable directories (at least not on the unixoid
systems i tested on) and so PHP glob() doesn't do it either.

The previos 'fix' for this bud didn't actually change the functions
behavior and is going to be reverted.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Feb 06 00:05:48 2023 UTC