php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 - 40 = ?
Subscribe to this entry?

 
 [2004-05-11 01:31 UTC] trancer at trancer dot nl
Description:
------------
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:
---------------
<?php
        error_reporting(E_ALL);
        print_r(glob('*.png'));
?>


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( )

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-12 02:55 UTC] hholzgra@php.net
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-2021 The PHP Group
All rights reserved.
Last updated: Wed Oct 27 10:03:34 2021 UTC