php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29612 Variable $php_errormsg disappears
Submitted: 2004-08-11 13:28 UTC Modified: 2004-08-28 20:28 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: tom at bitworks dot de Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 4.3.8 OS: Debian woody Apache/1.3.27 (Unix
Private report: No CVE-ID: None
 [2004-08-11 13:28 UTC] tom at bitworks dot de
Description:
------------
Searching for the behavior of all file functions and the right locking mechanisms I tried to use fopen(filename,xb) with former umask(0222). That was intended to trigger an error and look into $php_errormsg

But $php_errormsg was disappeared

Reproduce code:
---------------
error_reporting(E_ALL);
ini_set('track_errors','1');
$dateiname = 'opentest123.txt';
$mask = umask(0222);
echo "<br />Mask: $mask<br />";
$fh = fopen($dateiname,'xb+');
$_errors = debug_backtrace();
if (!$fh)
{
  echo "<br />Fehler: $php_errormsg<br />";
  echo "<br />Fehler: $php_errormsg<br />";
  echo '<pre>';
  print_r($_errors);
  echo '</pre>';
}
else
{
  echo "<br />Datei $dateiname wurde angelegt<br />";
  $write_ok = fwrite($fh, 'Testtext');
  echo "<br />Schreibversuch in $dateiname: $php_errormsg<br />";
}


Expected result:
----------------
Fehler: failed to open stream: Permission denied

Actual result:
--------------
Notice: Undefined variable: php_errormsg in /home/thomas/public_html/test/artikel_locking/opentest.php on line 27 

== echo "<br />Schreibversuch in $dateiname: $php_errormsg<br />";


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-11 13:30 UTC] tom at bitworks dot de
the open command was only:

$fh = fopen($dateiname,'xb');

without '+'
 [2004-08-28 20:28 UTC] sniper@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.

Ask support questions on how to use PHP elsewhere.

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jul 07 04:03:36 2022 UTC