how to suppress error messages without using error_reporting(0) ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    #1

    how to suppress error messages without using error_reporting(0) ?

    This line:

    if (file_exists($f ileName)) {


    is (on some web servers) giving me this kind of error:


    Warning: SAFE MODE Restriction in effect. The script whose uid is 1022
    is not allowed to access /home/www owned by uid 0 in
    /home/www/krubner/ppKernel/McControllerFor All.php on line 454


    This only happens when the software is checking directories that are
    above what where PHP is allowed to check.

    I want this software to work on all servers and I don't want the end
    user to have to know PHP, and so I don't want them to have to set
    error_reporting () on their own. I also feel like I shouldn't have to
    do this:

    error_reporting (0);

    because my software should capture all errors on its own and store all
    the error messages that I write in the resultsObject that my software
    uses. Turning off error reporting is cheating, in my view, the
    programmer should capture all errors on their own.

    So how do I suppress errors on a line like this?

    if (file_exists($f ileName)) {
  • Jedi121

    #2
    Re: how to suppress error messages without using error_reporting (0) ?

    lawrence a écrit le 30/04/2004 :[color=blue]
    > So how do I suppress errors on a line like this?
    >
    > if (file_exists($f ileName)) {[/color]

    Use the @ operator before the function call :
    if(@file_exists ($fileName)) {

    See manual for more details :



    Comment

    Working...