Jump to content


Photo

SMF 2.0.X -> IPB, Existing Members' Post Counts


Origin topic

Converting from SMF v2.0.2 -> IPB v3.3.3, Members

Error Description:
When importing members, if there is a duplicate member, usually the admin account used to initially setup a fresh IPB install, you can receive an error for an improperly formatted SQL statement.

mySQL query error: UPDATE members SET posts='posts+/'9999/'' WHERE member_id='1'

SQL error: Incorrect integer value: 'posts+'9999'' for column 'posts' at row 1
SQL error code: 1366
Date: Saturday 07th July 2012 12:50:38 AM


 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Date: Sat, 07 Jul 2012 00:50:38 +0000
 Error: 1366 - Incorrect integer value: 'posts+'9999'' for column 'posts' at row 1
 IP Address: [...] - /admin/index.php?adsess=...&app=convert&app=convert&module=board&section=smf&do=members&st=22500&cycle=250&total=130767
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 mySQL query error: UPDATE members SET posts='posts+/'9999/'' WHERE member_id='1'
 .--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
 | File                                                                       | Function                                                                      | Line No.          |
 |----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|
 | .../admin/applications_addon/ips/convert/sources/lib_master.php            | [db_main_mysql].update                                                        | 1315              |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | .../admin/applications_addon/ips/convert/modules_admin/board/smf.php       | [lib_master].convertMember                                                    | 539               |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 |                                                                            | [admin_convert_board_smf].convert_members                                     |                   |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
 | .../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               |
 '----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'


Replication Steps:
  • Fresh install IPB
  • Install Converter
  • Import SMF2 data (if not already)
  • Insert or update a member in the SMF database with the same email address as used in step #1
  • New Converter for SMF2
  • Run "Members" Conversion
  • Error should occur here, whenever it reaches the duplicate member

Suggested Fix:
/admin/applications_addon/ips/convert/sources/lib_master.php Line 1315
Find:
$this->DB->update('members', array('posts' => "posts+'{$info['posts']}'" ), "member_id='{$duplicateMember['member_id']}'");
Replace with:
$this->DB->preventAddSlashes(array('posts'));
$this->DB->update('members', 'posts=posts+' . (int) $info['posts'], 'member_id=' . (int) $duplicateMember['member_id'], false, true);

This would put it in the correct update syntax as for classDb.php & keep it from getting encapsulated:
UPDATE members SET posts=posts+9999 WHERE member_id=1


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

Status: Cannot Reproduce
Version: 1.2.3
Fixed In: 0


1 Comments

Updating Fixed In to: 0
Updating Status to: Cannot Reproduce
Updating Version to: 1.2.3

SMF doesn't allow me to create a duplicate of the one I made in step 1.