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
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC