ID:               32545
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mailfrom-bugs dot php dot net at kopka dot net
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Gentoo
 PHP Version:      5.0.3
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.

Note removed.


Previous Comments:
------------------------------------------------------------------------

[2005-04-02 18:22:13] mailfrom-bugs dot php dot net at kopka dot net

If the behavior is intended then please make the 

Note:  The "@" error-control operator prefix will not disable messages
that are the result of parse errors.

(which is wrong in the case of include) on page
http://de2.php.net/manual/en/language.operators.errorcontrol.php
more clear about this.

Thanks for your support.

------------------------------------------------------------------------

[2005-04-02 18:05:10] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

. 

------------------------------------------------------------------------

[2005-04-02 17:38:43] mailfrom-bugs dot php dot net at kopka dot net

The @include() also eats error messages for exceptions thrown inside
the included file which are not catched later on !

a.php
=====
<?php
class Test_Exception extends Exception {}
try [EMAIL PROTECTED]("b.php");}
catch (Test_Exception $e) {echo "Test_Exception thrown";}
echo "OK";
?>

b.php
=====
<?php
throw new Exception("something wrong");
?>


Expected result:
----------------
Fatal error: Uncaught exception 'Exception' with message 'something
wrong' in b.php:2
Stack trace:
#0 a.php(3): unknown()
#1 a.php(6): include_once('b.php)
#2 {main} thrown in b.php on line 2

Actual result:
--------------
OK

------------------------------------------------------------------------

[2005-04-02 17:21:33] mailfrom-bugs dot php dot net at kopka dot net

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 this bug report at http://bugs.php.net/?id=32545&edit=1

Reply via email to