Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Duplicate settings issue
#1
This conditional was drove from various other problems, but mainly caused by Fix #3644 which was included in the 1.4.2 update.

Quote:During the upgrade of a board using pgsql you get the following error:
Quote:Fatal error: [SQL] [0] ERROR: invalid input syntax for integer: "yes"
SELECT name,sid FROM mybb_settings WHERE isdefault='1' OR isdefault='yes' in /var/www/testforum.blubotter.org/htdocs/moepforum/inc/db_pgsql.php on line 552
The query can be found in the file upgrade.php in the lines 717 and 723.

Possible fix: Replace
		$query = $db->simple_select("settings", "name,sid", "isdefault='1' OR isdefault='yes'");
		while($setting = $db->fetch_array($query))
		{
			$settings[$setting['sid']] = $setting['name'];
		}

		$query = $db->simple_select("settinggroups", "name,title,gid", "isdefault='1' OR isdefault='yes'");
with:
        if($db->type == "mysql" || $db->type == "mysqli")
        {
            $wheresettings = "isdefault='1' OR isdefault='yes'";
        }
        else
        {
            $wheresettings = "isdefault='1'";
        }
		$query = $db->simple_select("settings", "name,sid", $wheresettings);
		while($setting = $db->fetch_array($query))
		{
			$settings[$setting['sid']] = $setting['name'];
		}

		$query = $db->simple_select("settinggroups", "name,title,gid", $wheresettings);

$db->type is not initialized in upgrade.php because $db->type is initialized in inc/init.php throughout the rest of MyBB except install/upgrade.php and install/index.php because they don't initialize inc/init.php. This in turn caused there "where" condition to always be "isdefault='1'".

This issue only affects those who are upgrading from 1.2.x -> 1.4.2. Anyone else who is having the issue experienced a separate bug caused in 1.4.1 but was fixed in 1.4.2. The fix simply stops that particular issue from happening again on a future upgrade. It doesn't automatically repair the previous issues caused by it because there is no easy way to do so.

The fix is to set $db->type in install/upgrade.php and inc/init.php.


Messages In This Thread
[F] Duplicate settings issue - by Ryan Gordon - 09-21-2008, 08:06 PM
[F] Duplicate settings issue - by Ryan Gordon - 09-21-2008, 08:06 PM
RE: [F] Duplicate settings issue - by labrocca - 09-21-2008, 08:18 PM
RE: [F] Duplicate settings issue - by Ryan Gordon - 09-21-2008, 08:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)