php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19211 fputs and fwrite problems
Submitted: 2002-09-03 12:54 UTC Modified: 2002-09-03 14:31 UTC
From: dw59 at earthlink dot net Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4CVS-2002-09-03 OS: Cobalt Linux (Redhat)
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: dw59 at earthlink dot net
New email:
PHP Version: OS:

 

 [2002-09-03 12:54 UTC] dw59 at earthlink dot net
This only recently began when I switched to a snapshot version 4.2.3-dev from 4.2.2 for an unrelated problem.

  //open, write to and close file
  $fp = fopen($html_xml_index_file, "w+");
  if (!$fp) exit ("Could not open " . $html_xml_index_file . " for writing!");
  $result = fputs($fp, $xml_data, strlen($xml_data));
 
  echo "bytes written - " . $result . "<br/>" . 
    "totol data length - " . strlen($xml_data) . "<br/>" . 
    "file handle - " . $fp;
  fclose($fp); exit;

Produces:

bytes written - 0
totol data length - 447356
file handle - Resource id #4

No data written...No errors produced.  Using either 'fputs' or 'fwrite' with or without the optional 'length' argument.

What is "Resource id #4"?  I thought a file pointer would be returned as an integer value?

Thanks,
DWilliams

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-03 13:20 UTC] derick@php.net
Should be fixed, try RC2 from www.php.net/~zeev/php-4.2.3RC2.tar.gz

Please reopen if it's not fixed (And a filepointer is indeed a resource, so that's OK).

Derick
 [2002-09-03 14:31 UTC] dw59 at earthlink dot net
bytes written - 447356
total data length - 447356
file handle - Resource id #4

All is well...

Thanks,
DWilliams
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 09:01:33 2024 UTC