php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #229 -f option ignored
Submitted: 1998-04-02 04:51 UTC Modified: 1998-04-10 11:00 UTC
From: rabedell at students dot wisc dot edu Assigned:
Status: Closed Package: Other
PHP Version: 3.0 Release Candidate 3 OS: Windows NT 4
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rabedell at students dot wisc dot edu
New email:
PHP Version: OS:

 

 [1998-04-02 04:51 UTC] rabedell at students dot wisc dot edu
I try using the -f option to parse a file,
and it reads it in from stdin instead.
I believe this is due to php3_fopen_for_parser:

small bug, but eh.

#ifndef S_ISREG
#define S_ISREG(mode)	(((mode)&S_IFMT) == S_IFREG)
#endif

if (fp && (0 > fstat (fileno (fp), &st) ||
  !S_ISREG(st.st_mode))) {
    fclose (fp);
    fp = NULL;
}

the S_ISREG might be wrong under Win32:

Get information about an open file.
int _fstat( int handle, struct _stat *buffer );
__int64 _fstati64( int handle, struct _stat *buffer );  
  
Remarks
The _fstat function obtains information about the open file associated with handle and stores it in the structure pointed to by buffer. The _stat structure, defined in SYS\STAT.H, contains the following fields:

st_atime   Time of last file access.
st_ctime   Time of creation of file.
st_dev   If a device, handle; otherwise 0.
st_mode   Bit mask for file-mode information. The _S_IFCHR bit is set if handle refers to a device. The 

_S_IFREG
***************underscore?

bit is set if handle refers to an ordinary file. The read/write bits are set according to the file?s permission mode. _S_IFCHR and other constants are defined in SYS\STAT.H.
st_mtime   Time of last modification of file.
st_nlink   Always 1 on non-NTFS file systems.
st_rdev   If a device, handle; otherwise 0.
st_size   Size of the file in bytes.
If handle refers to a device, the st_atime, st_ctime, and st_mtime and st_size fields are not meaningful. 
Because STAT.H uses the _dev_t type, which is defined in TYPES.H, you must include TYPES.H before STAT.H in your code.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-10 11:00 UTC] zeev
Fixed, see bug #247
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 09:01:27 2024 UTC