Jump to content


Photo

SMF 2.0.X -> IPB, Polls & starter_id's


Converting from SMF v2.0.2 -> IPB v3.3.4, Polls

Error Description:
When importing polls, some values are not being passed with the correct type. In this case it is when a starter_id no longer exists in the database. In my case, it was one of my own polls created under my admin account on SMF. When I did the conversion, I took user ID 1 (instead of 22649 in SMF) and that user (22649) never got inserted into the database.

mySQL query error: INSERT INTO polls (`tid`,`start_date`,`choices`,`starter_id`,`votes`,`forum_id`,`poll_question`) VALUES(185432,1261027523,'a:1:{i:1;a:3:{s:8:\\\"question\\\";s:30:\\\"How many monitors do you have?\\\";s:6:\\\"choice\\\";a:6:{i:0;s:1:\\\"1\\\";i:1;s:1:\\\"2\\\";i:2;s:1:\\\"3\\\";i:3;s:1:\\\"4\\\";i:4;s:1:\\\"5\\\";i:5;s:2:\\\"6+\\\";}s:5:\\\"votes\\\";a:6:{i:0;s:1:\\\"5\\\";i:1;s:1:\\\"6\\\";i:2;s:1:\\\"2\\\";i:3;s:1:\\\"1\\\";i:4;s:1:\\\"1\\\";i:5;s:1:\\\"1\\\";}}}','',3742,22,'How many monitors do you have?')

SQL error: Incorrect integer value: '' for column 'starter_id' at row 1
SQL error code: 1366
Date: Friday 13th July 2012 08:50:01 PM


 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Date: Fri, 13 Jul 2012 20:50:01 +0000
 Error: 1366 - Incorrect integer value: '' for column 'starter_id' at row 1
 IP Address: [...] - /admin/index.php?adsess=...&app=convert&module=board&section=smf
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 mySQL query error: INSERT INTO polls (`tid`,`start_date`,`choices`,`starter_id`,`votes`,`forum_id`,`poll_question`) VALUES(185432,1261027523,'a:1:{i:1;a:3:{s:8:\\\"question\\\";s:30:\\\"How many monitors do you have?\\\";s:6:\\\"choice\\\";a:6:{i:0;s:1:\\\"1\\\";i:1;s:1:\\\"2\\\";i:2;s:1:\\\"3\\\";i:3;s:1:\\\"4\\\";i:4;s:1:\\\"5\\\";i:5;s:2:\\\"6+\\\";}s:5:\\\"votes\\\";a:6:{i:0;s:1:\\\"5\\\";i:1;s:1:\\\"6\\\";i:2;s:1:\\\"2\\\";i:3;s:1:\\\"1\\\";i:4;s:1:\\\"1\\\";i:5;s:1:\\\"1\\\";}}}','',3742,22,'How many monitors do you have?')
 .--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
 | File                                                                       | Function                                                                      | Line No.          |
 |----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|
 | .../admin/applications_addon/ips/convert/sources/lib_board.php             | [db_main_mysql].insert                                                        | 1210              |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | .../admin/applications_addon/ips/convert/modules_admin/board/smf.php       | [lib_board].convertPoll                                                       | 1157              |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 |                                                                            | [admin_convert_board_smf].convert_polls                                       |                   |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | .../admin/applications_addon/ips/convert/modules_admin/board/smf.php       | [].call_user_func                                                             | 90                |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | .../admin/sources/base/ipsController.php                                   | [admin_convert_board_smf].doExecute                                           | 306               |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'

As you can see, one of the columns (starter_id) is being passed as an empty string instead of an integer 0.

Replication Steps:
  • Fresh install IPB
  • Install Converter
  • Import SMF2 data (if not already)
  • New Converter for SMF2
  • Remove one of the poll starter's member data from the database, but leave the starter_id in the poll row.
  • Run "Polls" Conversion
  • Error should occur here, whenever it reaches the '0' starter_id

Suggested Fix:
/admin/applications_addon/ips/convert/sources/board.php Line 1206
Find
$info['starter_id'] = ($info['starter_id']) ? $this->getLink($info['starter_id'], 'members', false, $parent) : 0;
Replace
$info['starter_id'] = ($info['starter_id']) ? (int) $this->getLink($info['starter_id'], 'members', false, $parent) : 0;
* Note, this is just a bandaid. I was hoping the converter stored that type of information (duplicate email address users) in a linking table for future conversion information like this.

System Details:
Win 7x64
Apache 2.4.2
PHP 5.3.14
MySQL 5.5.21

Status: Not a Bug
Version: 0
Fixed In: 0


3 Comments

Updating Status to: Not a Bug

You're manually altering the database to create this?

Photo
MisterPhilip
Dec 30 2012 07:12 PM

No, although this could have been from bad data in the past. The forum has been around for a long time and originally started on IPB v1 -> v2 -> SMF -> IPB 3.3

Okay. I could not reproduce this locally unfortunately.