error reporting trouble

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

    error reporting trouble

    Hi,

    I have set in my .htaccess file

    php_flag error_reporting 2047

    to prevent error output to users.

    However, in some selected scripts I want to allow errors to be shown.
    I tried several things but I never get the combination done.

    How can I generally remove the reports and only allow it for special files
    by putting an instruction directly into the respective file?

    thanks

    Oliver

  • Pedro Graca

    #2
    Re: error reporting trouble

    Oliver Spiesshofer wrote:[color=blue]
    > However, in some selected scripts I want to allow errors to be shown.
    > I tried several things but I never get the combination done.
    >
    > How can I generally remove the reports and only allow it for special files
    > by putting an instruction directly into the respective file?[/color]


    use error_reporting ()



    #v+
    <?php
    function test_errors() {
    $x = $y;
    $x = 3/0;
    eval('$x err $y');
    }

    // Turn off all error reporting
    echo "\n\nerror_repo rting(0);";
    error_reporting (0);
    test_errors();

    // Report simple running errors
    echo "\n\nerror_repo rting(E_ERROR | E_WARNING | E_PARSE);";
    error_reporting (E_ERROR | E_WARNING | E_PARSE);
    test_errors();

    // Reporting E_NOTICE can be good too (to report uninitialized
    // variables or catch variable name misspellings ...)
    echo "\n\nerror_repo rting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);";
    error_reporting (E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
    test_errors();

    // Report all errors except E_NOTICE
    // This is the default value set in php.ini
    echo "\n\nerror_repo rting(E_ALL ^ E_NOTICE);";
    error_reporting (E_ALL ^ E_NOTICE);
    test_errors();

    // Report all PHP errors (bitwise 63 may be used in PHP 3)
    echo "\n\nerror_repo rting(E_ALL);";
    error_reporting (E_ALL);
    test_errors();
    ?>
    #v-
    --
    --= my mail box only accepts =--
    --= Content-Type: text/plain =--
    --= Size below 10001 bytes =--

    Comment

    Working...