Jump to content

Disable notices


sermolux

Recommended Posts

I've been writing php for a while now, and I've never come across this problem:

 

I've been getting "Notice: Undefined index:" for $_GET and $_POST variables.

I've fount away around this by using isset():

 

if( isset( $_GET["name"] ) )
{
$name = $_GET["name"];
}
else
{
$name = "";
}

 

I'm also getting a notice when I use the date() function without quotes around an argument:

 

date( i );

 

I don't mind making these changes... Probably better anyway, but I'm at a loss to why these notices have started to show up. I haven’t changed anything, and my php.ini file is set to not display notices. Any thoughts?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/66608-disable-notices/
Share on other sites

Well presumably your php.ini file is set to report notices, otherwise it wouldn't be reporting them. I thought the default was changed at some point to include notices, but apparently not.

 

Anyways, you should be using:

E_ALL & ~E_NOTICE

 

To not report notices, but still report other errors.

Link to comment
https://forums.phpfreaks.com/topic/66608-disable-notices/#findComment-333728
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.