Reputation: 21
i have this errors in error log
mod_fcgid: stderr: PHP Notice: Undefined index: url in /var/www/vhosts/mysite.it/httpdocs/wp-content/themes/colormag-pro/js/sharrre/sharrre.php on line
4 lines affected.
Are they dangerous for my site? How can i fix them exactly?
UPDATE: First 4 lines of this code in sharre.php get errors
$json['url'] = $_GET['url'];
$url = urlencode($_GET['url']);
$type = urlencode($_GET['type']);
if(filter_var($_GET['url'], FILTER_VALIDATE_URL)){
if($type == 'googlePlus'){ //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/
$contents = parse('https://plusone.google.com/u/0/_/+1/fastbutton?url=' . $url . '&count=true');
Upvotes: 0
Views: 2936
Reputation: 455
Not too bad, annoying. A 'Notice' is something that PHP can carry on with but may cause something else to break, but on the same hand might not cause anything to break at all. A lot of the time 'Notices' can be ignored and are generally turned off in production environments.
Personally I hate to see 'Notices' in my code but that's just me.
Either $json['url'], $_GET['url'], or both are not set so check both and see which one is not being set, from there you will be able to trace back to what is supposed to be setting the variable and fix it.
Use an isset() to check if each one is set before the first line of the code you pasted to check if either one is not actually set.
Upvotes: 1
Reputation: 3498
This is not dangerous for your site per se. The variable(s) in the GET are not set (variables $_GET['url'] is not set). If you plan to use it later in your PHP script, you should set them before, on the previous page. So, there are two pages, first one and your PHP page - the second one.
Upvotes: 0