php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #491 Can't get rid of file system error message when file doesn't exist
Submitted: 1998-06-29 10:26 UTC Modified: 1998-06-29 13:27 UTC
From: khapeman at skidmore dot edu Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0 Final Release OS: Solaris 2.5.1
Private report: No CVE-ID: None
 [1998-06-29 10:26 UTC] khapeman at skidmore dot edu
<H1>File Error Message Test</H1>
<?
$cmd = "ls dir/transactions1/junk.170_*";
$tst = @exec($cmd);
?>

This produces the following message before the heading is displayed:

dir/transactions1/junk.170_*: No such file or directory 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-06-29 13:27 UTC] zeev
ls writes to stderr, which isn't piped by popen(), which
results in this behavior.  There's nothing you can do about
it at the PHP level.

You can, however, ask the shell to do the job for you,
by doing something like:

$tst = @exec("ls dir/transactions1/junk.170_* 2> /dev/null");

which tells sh to redirect all stderr output to /dev/null.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 02:01:29 2024 UTC