未定义的变量_GET

I got a problem with a php webapplication. It stops working after 10-20 hours for no reason because $_GET is not defined.

The request looks like:

http://host/index.php?id=1

the index file has a lil code snippet like:

if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $id = intval($_GET['id']);
} else {
    die('wrong id');
}

A var_dump of $_GET returns NULL. A var_dump of $_SERVER shows the REQUEST_METHOD is GET and the QUERY_STRING is id=1. A var_dump() of $_REQUEST shows id => 1, so it's only $_GET that isn't working.

When that happens it happens for all webapplications on the server and for all users. After restarting the webserver everything is working again for some hours...

System is Windows 2008 R2, Apache 2.4.18 32 Bit/PHP 7.0.4 32 Bit.

Using is_numeric function on GET value that is not set may give an error and stop your script.

Make sure that GET value is set before using is_numeric function on it.

if(!isset($_GET['id']))
{
    die('wrong id');
}
elseif(is_numeric($_GET['id']))
{
    $id = intval($_GET['id']);
}
else
{
    die('wrong id');
}

In case your $_REQUEST var holds the value but $_GET does not, there has been a bug report filed: https://bugs.php.net/bug.php?id=73554