From:             mailfrom-bugs dot php dot net at kopka dot net
Operating system: Gentoo
PHP version:      5.0.3
PHP Bug Type:     Feature/Change Request
Bug description:  @include() supresses even Parse Errors

Description:
------------
I don't know how to classify this so i leave it to someone who might have
a better idea how to deal with this:

BUG DESCRIPTION
===============

@include() supresses all error messages, INCLUDING PARSE ERRORS, in the
included script and all descendents.
This also affects __autoload so that there are no warnings whatsoever when
something goes wrong.
This makes a script using @include undebugable!


DOCUMENTATION PROBLEM
=====================
http://de2.php.net/manual/en/language.operators.errorcontrol.php states
that:
Note:  The "@" error-control operator prefix will not disable messages
that are the result of parse errors.

which is clearly wrong (see example).

It also states in the follwing warning:
Currently the "@" error-control operator prefix will even disable error
reporting for critical errors that will terminate script execution. Among
other things, this means that if you use "@" to suppress errors from a
certain function and either it isn't available or has been mistyped, the
script will die right there with no indication as to why. 

which also quite misses the current behavior.

It seems to me that the current implementation of the @ operator is to set
error_reporting to E_NONE for the evaluation of the following expression
This is OK for something like
@list($a, $b, $c) = explode($sep, $string);
where it catches the 'Undefined offset' note. 

I ran into this doing the following:

if ([EMAIL PROTECTED]($path1.$filename)) {require_once($path2.$filename);}

wondering why the script terminates somewhere silently without giving a
notice about a reason.
After some hours of digging i found the error which aborted the script and
then traced the missing fatal back to the @include().


FEATURE REQUEST
===============

@ should modify error_reporting only for the current expression, and not
globally until the evaluation is complete.

RELATED
=======
Effect is also visible in example of Bug #31736


Reproduce code:
---------------
File include.php
------------------
<?php
@include("included.php");
?>

File included.php
------------------
<?php
[parse error of your choice]
?>


Expected result:
----------------
Parse error: parse error, unexpected [something] in included.php on line 2

Actual result:
--------------
FATAL error message is supressed.


-- 
Edit bug report at http://bugs.php.net/?id=32545&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=32545&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=32545&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=32545&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=32545&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=32545&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=32545&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=32545&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=32545&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=32545&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=32545&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=32545&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=32545&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=32545&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=32545&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=32545&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=32545&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=32545&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=32545&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=32545&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=32545&r=mysqlcfg

Reply via email to