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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Pull Requests

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 Oct 04 22:01:27 2024 UTC