Undefined index: rguserid in RaygunClient.php line 164
rhysied
Posted on
Jul 08 2014
Hi,
Updated one of our projects earlier on to to the newest version available in composer (git ref. af96ad3), and now our server is coming up with the following error:
2014/07/07 15:57:45 [error] 15765#0: *48445514 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: rguserid in /var/www/(host)/vendor/mindscape/raygun4php/src/Raygun4php/RaygunClient.php on line 164" while reading response header from upstream, client: (ip), server: (server name), request: "GET /(requestUrl) HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "(host)", referrer: "(referrer)"
I've had a look at the code and the error is in SetUser function, where its looking for a cookie using the following line:
$this->user = $_COOKIE['rguserid'];
I'm not sure if the value should be 'rguuid' as the block above it checks if that value does not exist and then sets it, else use $_COOKIE['rguserid'] (probably easier if I just copy the block)
if (!arraykeyexists('rguuid', $_COOKIE)) { $this->user = (string)Uuid::uuid4();
if (php_sapi_name() != 'cli' && !headers_sent())
{
setcookie('rguserid', $this->user, $timestamp);
setcookie('rguuid', 'true', $timestamp);
}
}
else
{
$this->user = $_COOKIE['rguserid'];
}
The issue is happening intermittently at the moment, but the concerning thing is that if there is an error causing this, it's actually blocking it from coming through.
Cheers, Rhys.
Callum
Posted on
Jul 08 2014
Thanks for reporting this one and the comprehensive repro, we're working on a fix and another improvement to this feature which should be released in the near term - will let you know.
Edit: There should be a fix for this condition available from https://github.com/MindscapeHQ/raygun4php.git now, if you could clone that, add it to your site and confirm that resolves the error we'll get it released on Composer.
Regards,
Callum Gavin
Mindscape Limited
rhysied
Posted on
Jul 08 2014
Thanks Callum.
I'll get this up and running on our projects and let you know if we have any more issues.
Cheers, Rhys.
rhysied
Posted on
Jul 11 2014
So we have been running with the cloned version for the last few days and it seems to have cleared up the issue. Do you know when this will be added to the composer version?
Thanks, Rhys.
Callum
Posted on
Jul 11 2014
We're looking at early next week for a new release, with this and a couple of other features/fixes. Will post here when it is available.
Regards,
Callum Gavin
Mindscape Limited