php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21618 fopen on no existing files generates unexpected output.
Submitted: 2003-01-13 11:02 UTC Modified: 2003-01-13 15:38 UTC
From: martin at kitv dot co dot uk Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.2.3 OS: Apache on RedHat Linux
Private report: No CVE-ID: None
 [2003-01-13 11:02 UTC] martin at kitv dot co dot uk
I planned to use the following function testing for a flag file 'offline_message.txt' to disable my application and contain an offline message.

function isOffLine() {
  global $OffLineMessage;
  $OffLineMessage = "" ;
  $OffLineFilename = "offline_message.txt" ;

  if (!($fp = fopen($OffLineFilename, "r"))) {
    return false;
    } else {
    $OffLineMessage = file( $OffLineFilename ) ;
    return true;
    }
}

However bothe the fopen & file functions generates an unexpected and unwanted warning messages to the output stream.

Warning: fopen("offline_message.txt", "r") - No such file or directory in /var/www/html/webmail/common.php on line 104

Warning: file("offline_message.txt") - No such file or directory in /var/www/html/webmail/common.php on line 105



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-13 15:38 UTC] sterling@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Dec 01 14:00:02 2025 UTC