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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 13:00:02 2026 UTC