php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34498 is_dir isn't recognized?
Submitted: 2005-09-14 08:27 UTC Modified: 2005-09-14 16:38 UTC
From: johannes at jlindenbaum dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.4.0 OS: Mac OS X 10.4.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: johannes at jlindenbaum dot de
New email:
PHP Version: OS:

 

 [2005-09-14 08:27 UTC] johannes at jlindenbaum dot de
Description:
------------
Hi,

Don't know if it's just me but XAMPP distrib with php 4.4.0 running parsing following PHP code doesn't work.

Clearly the $handle directory I am reading contains directories. These are not recognized and thus not put into the array!

htdocs in Apache has full 777 for developing purposes.

Reproduce code:
---------------
$directories = array();
while( FALSE !== ($file_names = readdir($handle)) ) {
	if( $file_names != "." && $file_names != "..") {
		if( !is_dir($file_names) ) {
			echo $file_names;
		}
		else {
			$directories[]	= $file_names;
		}
	}
}

Expected result:
----------------
I expect directories found in the read directory to be added into the $directories array.

Actual result:
--------------
Directory is outputted as if it were a file.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-14 09:29 UTC] sniper@php.net
The full path to the directories must be readable by the apache user for this to work. Never rely on the "left-overs" to be really readable and usable files.
 [2005-09-14 16:19 UTC] johannes at jlindenbaum dot de
As a test I gave the complete /Applications/xampp folder

chmod -R 777

same outcome!

Works fine on SuSEn (self  built - not XAMPP) or Win XP Pro SP2 (not on Apache but on self built Apache, PHP MySQL
 [2005-09-14 16:38 UTC] johannes at jlindenbaum dot de
Hmm - let me try taht again in english.

It works on SuSE and WIN XP - both of those OS I have self built the Apache, PHP, MySQL.

Only Mac OS X uses apachefriends.org's XAMPP for Mac OS X.

I gave /Applications/xampp/  chmod -R 777. Same outcome? My bad or bug? Reproducable?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Dec 04 23:00:01 2025 UTC