Jump to content

[BUG 4.7.0] Upgrade from IPB 3.1.4 + Nexus 1.2.2 throws "Truncated incorrect DOUBLE value" error


Recommended Posts

I hit the error updating an old 3.1.4 site. The problem is that some packages have a NULL or empty string value for the p_base_price column in the nexus_packages table instead of 0. The upgrade process stops because MYSQL complains about a "Truncated incorrect DOUBLE value" error.

 

Open the file \applications\nexus\setup\upg_40000\upgrade.php and fine the code on lines 585-594:

	public function step14()
	{
		$offset = isset( \IPS\Request::i()->extra ) ? \IPS\Request::i()->extra : 0;
		$select = \IPS\Db::i()->select( '*', 'nexus_packages', NULL, 'p_id', array( $offset, 50 ) );
		if ( \count( $select ) )
		{		
			foreach ( $select as $row )
			{		
				\IPS\Lang::saveCustom( 'nexus', "nexus_package_{$row['p_id']}", $row['p_name'] );
				\IPS\Lang::saveCustom( 'nexus', "nexus_package_{$row['p_id']}_assoc", $row['p_assoc_error'] );

 

I simply added this code below right at the start of the foreach cycle to fix the issue:

				# Change NULL or EMPTY STRING prices to 0 to avoid "Truncated incorrect DOUBLE value" errors
				$row['p_base_price'] = empty($row['p_base_price']) ? 0 : $row['p_base_price'];

 

Edited by teraßyte
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...