Sep 17 2010

VBulletin 4.0.7: they rocked me again

Category: Articles,VBulletinFractalizeR @ 12:19 pm

For some time I was deeply afraid of installing any new release of VBulletin to the forum I administer. But after 4.0.7 came out with several performance bugs fixed I though, that may be it’s time to install it and hoped that installation will go smooth. I closed the forum for 1 hour, blamed myself for writting “1 hour” in the closed message text because surely simple bugfix forum update cannot take longer than 15 mins, right? NOWAY. I was mistaken.

Problems came immediately with running installer. HTTP 404 error on /install.php which obviously does not exist looked quite familiar.I proceed with installation by manually fixing paths. About 10-15 times. After I started to have the same problem on addons update and style updates I recalled that this is a KNOWN ISSUE of 4.0.4 which is marked as Fixed in bugtracker. So, it’s fixed, eh?

Here is a piece of code, that perfectly worked in 4.0.3. BTW, it was absent in 3.8.x at all and as you understand, 3.8.x worked just perfect. How? Miracles!

$url_info['script'] = '/' . ltrim($_SERVER['SCRIPT_NAME'], '/\\');

But no. One line of code is no more enough, they say. And in 4.0.7 it is:

/*
			values seen in the wild:
 
			CGI+suexec:
			SCRIPT_NAME: /vb4/admincp/index.php
			ORIG_SCRIPT_NAME: /cgi-sys/php53-fcgi-starter.fcgi
 
			CGI #1:
			SCRIPT_NAME: /index.php
			ORIG_SCRIPT_NAME: /search/foo
 
			CGI #2:
			SCRIPT_NAME: /index.php/search/foo
			ORIG_SCRIPT_NAME: /index.php
 
		*/
 
		if ((PHP_SAPI == 'cgi' OR PHP_SAPI == 'cgi-fcgi') AND (isset($_SERVER['ORIG_SCRIPT_NAME']) AND !empty($_SERVER['ORIG_SCRIPT_NAME'])))
		{
			if (substr($_SERVER['SCRIPT_NAME'], 0, strlen($_SERVER['ORIG_SCRIPT_NAME'])) == $_SERVER['ORIG_SCRIPT_NAME'])
			{
				// cgi #2 above
				$url_info['script'] = $_SERVER['ORIG_SCRIPT_NAME'];
			}
			else
			{
				// cgi #1 and CGI+suexec above
				$url_info['script'] = $_SERVER['SCRIPT_NAME'];
			}
		}
		else
		{
			$url_info['script'] = (isset($_SERVER['ORIG_SCRIPT_NAME']) AND !empty($_SERVER['ORIG_SCRIPT_NAME'])) ? $_SERVER['ORIG_SCRIPT_NAME'] : $_SERVER['SCRIPT_NAME'];
		}
                $url_info['script'] = '/' . ltrim($url_info['script'], '/\\');

Isn’t it nice? Do you understand what it does? CRAP!

I commented the last line and added

$url_info['script'] = '/' . ltrim($_SERVER['SCRIPT_NAME'], '/\\');

below. Hello from past. But it works.

My best disregards to VBulletin QA team. I am looking forward to install XenForo.

Tags:

Leave a Reply

You must be logged in to post a comment. Login now.