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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.