[thelist] "Notice: ..." errors
Burhan Khalid
thelist at meidomus.com
Tue Jul 13 10:30:03 CDT 2004
rich wrote:
>>I am testing a templating class I might want to use
>>(http://www.phpclasses.org/browse/package/807.html). It gives errors
>>like this:
>>
>>Notice: Undefined index: vals in c:\documents and settings\owner\my
>>documents\websites\testsystems\grooops.com\htdocs\mytemplate\MyTemplate.
>>class.php on line 528
>>
>>If I add the following line (default in php.ini), the errors go away:
>>
>>error_reporting(E_ALL ^ E_NOTICE);
>>
>>My question: do does errors mean that the class still has problems and I
>>should look for another template class, or is it ok to use it (and
>>"supress" the errors) on a production system?
>
>
> well they are warnings and IMO they indicate sloppy code or code expecting
> register_globals to be on so I would personally steer clear of it as there
> is likely to be other bugs or problems especially in a globals off
> environment...
This is not entirely true.
The following code, which doesn't rely on register_globals will generate
a Notice.
<?php
error_reporting(E_ALL);
echo $_POST['x'];
?>
However, slightly modified, it produces no Notices:
<?php
error_reporting(E_ALL);
echo @$_POST['x'];
//Another -- better way
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
echo $_POST['x'];
}
?>
More information about the thelist
mailing list