|  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
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.
Block user comment
Status: Assign to:
Bug Type:
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)

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


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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-10 11:00 UTC] zeev
Fixed, see bug #247
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Dec 03 20:05:54 2022 UTC