php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1627 Opendir does not behave the same on Windows platform as on Unix(Linux)
Submitted: 1999-06-29 15:38 UTC Modified: 1999-06-29 22:45 UTC
From: fredm at esoterica dot pt Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0 Latest CVS (29/06/1999) OS: Win NT 4 SP5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fredm at esoterica dot pt
New email:
PHP Version: OS:

 

 [1999-06-29 15:38 UTC] fredm at esoterica dot pt
I use the following code to test for the existance of a directory
if($rc = opendir($directory)) {
   /* Perform code for directory exists */
else {
   /* Create directory and do create processing */
}
This code works fine on Linux but always gives a good return even if the directory does not exist on Windows.
Looking in readir.c i see the following code
if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) {
     if (errno == ENOENT)
	dp->finished = 1;   <-- I'm not sure what this is supposed to do
     else
	return NULL;
}
It seems that the function is to behave differently if the file does not exist, than if there is an error in the file
spec.  If I comment out the check for enoent, and return null if the file does not exist, and recompile, my 
code works identically on Windows and Linux. 

 If I was sure of why the code was originally set up like it is, I'd have a go at fixing it, even with my very rusty
C, but I guess I need to mess around a little more with the source, and watch how you guys do it, before I 
push the boat out.

Best regards. . . Fred 
 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-29 22:45 UTC] jim at cvs dot php dot net
Fixed in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 03:01:32 2024 UTC