$referer = null_change($_SERVER["HTTP_REFERER"], "");
When I execute the above, the following error is displayed.
Notice: Undefined index: HTTP_REFERER in (path) on line (number)
To solve that error, I created the following function and used it to assign default values of $_SERVER, $_POST, and $_GET.
function null_change(&$var, $type)
{
if(is_null($var) === true) { $var = $type; }
}
$referer = null_change($_SERVER["HTTP_REFERER"], "");
This does not indicate any error, and now I can set default value to $_SERVER ["HTTP_REFERER"] with "".
However, some of posts below say that to use reference variables in PHP is dangerous.
https://stackoverflow.com/a/603488/8113216
https://schlueters.de/blog/archives/125-Do-not-use-PHP-references.html
I have read the above posts in detail, but I can't understand why using reference variables could be a problem in my case.
using reference variables can be a problem in my case?
update :
this question is about danger of reference variables. not about reliability of HTTP_REFERER.