note 62122 added to ref.errorfunc
| From: | email_php_28429 at wg-karlsruhe dot de | Date: | Mon, 20 Feb 2006 19:52:59 +0000 |
| Subject: | note 62122 added to ref.errorfunc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104080@lists.php.net to get a copy of this message | ||
if you cannot use php 5+ and if you do not know, when your administrator/provider will update to a
newer php-version, this could be interesting. otherwise it surely is not. ;-)
if you use the example above "example 1: using error handling in a script" with a php
version prior to php 5, the part
<?php
$errortype = array(
// ...
E_STRICT => "Runtime Notice");?>
will throw a notice like
"Use of undefined constant E_STRICT - assumed 'E_STRICT'".
of course one could avoid this problem, with
<?php
if(defined('E_STRICT')) define('E_STRICT', 2048);
?>.
but this _could_ generate problems in future versions of php, if E_STRICT is set to 42 or something
else.
for this reason i suggest
<?php
$errortype = array(
E_ERROR => 'error',
E_WARNING => 'warning',
E_PARSE => 'parsing error',
E_NOTICE => 'notice',
E_CORE_ERROR => 'core error',
E_CORE_WARNING => 'core warning',
E_COMPILE_ERROR => 'compile error',
E_COMPILE_WARNING => 'compile warning',
E_USER_ERROR => 'user error',
E_USER_WARNING => 'user warning',
E_USER_NOTICE => 'user notice');
if(defined('E_STRICT'))
$errortype[E_STRICT] = 'runtime notice';
?>.
<?php
// and instead of
// error_reporting(E_ALL | E_STRICT);
// one can use
error_reporting(E_ALL | (defined('E_STRICT')? E_STRICT : 0));
// to avoid that notice.
?>
prosit
seth
----
Server IP: 217.13.201.10
Probable Submitter: 84.57.250.58
----
Manual Page -- http://www.php.net/manual/en/ref.errorfunc.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+62122
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62122&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62122&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62122&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62122&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62122&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62122&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62122&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+62122&report=yes
Search -- http://master.php.net/manage/user-notes.php