vBulletin 4.x 500 server error while using vaultwiki simplified links and vbseo

I have Vaultwiki installed alongside vbseo. I had vbseo all set up and working and my vaultwiki was throwing 500 server errors when I tried to use their simplified link system. When I turned off vbseo, vaultwiki worked fine. I had the Vaultwiki guy take a look and he said the issue was with vbseo. Here is the fix he implemented.

In vbseo/includes/functions_vbseo_hook.php, find:

Code:
if(!strstr($_SERVER['HTTP_REFERER'],$_SERVER['VBSEO_URI']) AND !vbseo_is_threadedmode())
Not sure why, but this throws a 500 server error on your server when: $_SERVER['HTTP_REFERER'] is empty, and this is common IIRC.

To account for this possibility, the line should instead be:

Code:
if((!$_SERVER['HTTP_REFERER'] OR !strstr($_SERVER['HTTP_REFERER'],$_SERVER['VBSEO_URI'])) AND !vbseo_is_threadedmode())
See this thread for the whole story.
mod rewrite question
 
Just to follow-up, this wasn't an instant case of blame-the-other-guy for me. I spent a good amount of time tracing hundreds of lines of code in VaultWiki / vBulletin until I came to the vBSEO sec function call, and finally pin-pointed this line as the culprit of server 500.

Even if the error cannot be reproduced with empty $_SERVER['HTTP_REFERER'], the edit definitely doesn't hurt. If nothing else it will avoid a function call in some cases (php.net says strtr is slower than strpos). And it will prevent the issue from resurfacing for tagman on the next vBSEO update.
 
Crawlability