Advertisement:

Author Topic: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.  (Read 21327 times)

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Hi all,

I'm trying to convert from IPB 2.0.0 trial to the latest SMF.

I have downloaded and installed the latest conversion tool.

By running it, I had first the "birthday" error. Fixed by adding a solution found here

                     if(!preg_match('/\d{4}-\d{2}-\d{2}/', $row['birthdate']))
                        $row['birthdate'] = '0001-01-01';


Now I have another issue: Converting members...Wrong value type sent to the database. Integer expected. (instant_messages)

Any advice about this one ?

Thanks in advance
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Which converter are you using?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Invision 2 to SMF 2-0
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Of course :P Did you get it from the downloads page or one of the sticky topics in this board?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Thanks ;) I needed to know which file to pick.

That issue is caused by your original database (IPB) has something other than in integer in that column (most likely a NULL). So we have to tell the converter to make all those rows in integers.
Open the .sql file and find:
Code: [Select]
$row['signature'] = substr(strtr(strtr($row['signature'], '<>', '[]'), array('[br /]' => '<br />')), 0, 65534);Add after:
Code: [Select]
$row['instant_messages'] = (int)$row['instant_messages'];
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Added here:

Code: [Select]
), ltrim($row['signature'])));
$row['signature'] = substr(strtr(strtr($row['signature'], '<>', '[]'), array('[br /]' => '<br />')), 0, 65534);
$row['instant_messages'] = (int)$row['instant_messages'];


Same error :(  Converting members...Wrong value type sent to the database. Integer expected. (instant_messages)
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Just wondering about one point : do I use the right converter ?
« Last Edit: June 10, 2014, 05:26:14 AM by LeYoyo »
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
It seems you are, if you downloaded the latest version from the downloads page ;)

I forgot this issue, sorry. But I can't really understand why you're still having that error :(
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Is there any way to drop the IPB instant message values ?
It's a workaround, but at least, after migration I could inform the members that they have to refill these informations.
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Maybe the sense is different here. What values do you have in IPB's table in the corresponding field?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Humm, strange... I couldn't find an instant_message field in the member tables...

In the ibf_member_extra table I have:

aim_name = varchar(40)
icq = int(15)
yahoo = varchar(40)
msn = varchar(200)
skype = varchar(250)
Sous SMF 2.0.8

Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
"instant_messages" is the name of the column in SMF. It should be called "msg_total" in the IPB database.
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
OK, sorry ^^

msg_total     smallint(5)

Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Give your IPB table a look, check for non-integer values in that column
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
I did a double check, but can't find something else as integers (from 0 to 403) or NULL value
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Hummmm how odd...

Check the latest row that was added to SMF members table, get his id, then go to IPB members table and check what the next id has in msg_total, please
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
No row were added to the SMF members DB
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Hu, right on the first row? Damn... And what value has your first row in IPB's table?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
1100
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
No idea :o Can you please attach the converter and .sql file you are using?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
I deleted everything and restart the conversion.

First I got one more time the birthdate issue, then the instant_message, but this time (don't ask me why..) it worked.
After that, I got the same issue for hide_email. Solved in the same way (I hope it's OK...)

Code: [Select]
$row['signature'] = substr(strtr(strtr($row['signature'], '<>', '[]'), array('[br /]' => '<br />')), 0, 65534);
$row['instant_messages'] = (int)$row['instant_messages'];
$row['hide_email'] = (int)$row['hide_email'];

Finally :
Code: [Select]
$row['signature'] = substr(strtr(strtr($row['signature'], '<>', '[]'), array('[br /]' => '<br />')), 0, 65534);
$row['instant_messages'] = (int)$row['instant_messages'];
$row['hide_email'] = (int)$row['hide_email'];
$row['pm_email_notify'] = (int)$row['pm_email_notify'];


Next error : Converting topics...Wrong value type sent to the database. Integer expected. (id_poll)

Can I do the same (int cast) as for the other one and at the same place ?
« Last Edit: June 14, 2014, 12:15:33 PM by LeYoyo »
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
As long as it's integers, the cast works.
I just have no idea why that happens :o
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
it don't work. I cannot find where to put the cast :/ for the id_poll

Any advice ?
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Still working on the conversion. I think I'm not far from goal. After making some changes I found in different topics, now I'm blocked here...

I used [mywebfiles] to mask the real hosting url

Code: [Select]
Converting polls... Successful.
Converting poll options...
Warning: array_keys() [function.array-keys]: The first argument should be an array in [mywebfiles]/convert.php on line 1291

...  Many many of these eror lines

Warning: Invalid argument supplied for foreach() in [mywebfiles]/convert.php on line 2627

Warning: array_combine() [function.array-combine]: Both parameters should have an equal number of elements in [mywebfiles]/forum/Sources/Subs-Db-mysql.php on line 627
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3


Any idea about this issue (at the moment, I couldn't find a way of solution)
« Last Edit: June 17, 2014, 04:15:23 AM by LeYoyo »
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
I tried to jump directly to the step 10.

The conversion is reaching the end and everything works well. Except the polls of course. So as expected, This is the last issue to fix and the full conversion will be possible :)
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Can you please attach the converter you're using now?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Here is it.
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Please add convert.php also ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Here is it (I didn't change it)
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
I have no idea, sorry :(

Maybe you can try to use the code from emanuele's converter for 3.x in that particular topic (poll options)
Code: [Select]
/******************************************************************************/
--- Converting poll options...
/******************************************************************************/

---* {$to_prefix}poll_choices
---{
$no_add = true;
$keys = array('id_poll', 'id_choice', 'label', 'votes');
$choices = @unserialize(stripslashes($row['choices']));

if (is_array($choices))
{
foreach ($choices as $choice)
{
// Put the slashes back
$choice = addslashes_recursive($choice);

// Since we modified the poll thing, we need to stick the question in here
$pollquestion = $choice['question'];
$query = convert_query("
UPDATE {$to_prefix}polls
SET question = '$pollquestion'
WHERE id_poll = '$row[id_poll]'");

// Now that we've handled the question, go ahead with our choices and votes
foreach($choice['choice'] AS $choiceid => $label)
{
// The keys of the votes array correspond to the keys of the choice array,
// which are the ID_CHOICE values
$votes = $choice['votes'][$choiceid];

// Try to work around the multiple-questions-per-poll issue...
if(isset($current_choices[$row['id_poll']][$choiceid]))
continue;
else
$current_choices[$row['id_poll']][$choiceid] = $label;

// Finally - a row of information!
                        $rows[] = array(
                   'id_poll' => $row['id_poll'],
                   'id_choice' => $choiceid,
                   'label' => substr(addslashes($label), 0, 255),
                   'votes' => $votes,
                );
}
}
}
---}
SELECT pid AS id_poll, choices
FROM {$from_prefix}polls;
---*
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
conversion restarted. Let's see if it works.

If not, then I will try to remove all the poll tables migration. It's probably better than have just some of them migrated...
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
So, conversion finished

Conversion Complete
Congratulations, the conversion has completed successfully. If you have or had any problems with this converter, or need help using SMF, please feel free to look to us for support.



But no poll options in the polls. I think I will let this like it is, as no solution is available at this time...

But I have other issues...

1. before each ' there is a \
2. in the section descriptions, I have <br /> each time the description starts a new row
3. All the letters with accents (it's a french forum) are missing.

Example :
« Last Edit: June 19, 2014, 04:14:12 PM by LeYoyo »
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
accent issue solved : I had to install the french package instead of the frenchUTF8 package
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
So, last update:

- I changed the < br/> and the \ manually.
- I couldn't find a solution for the poll options, so they will stay so (poll topics still visible, but no way to see the poll options)
- attachements is an issue too, but I will let them in the status they are after migration. Too much effort to do this manually.


So, everything isn't fixed, the migration is, let say, 99% OK, so thanks a lot to everybody for the help !

« Last Edit: June 23, 2014, 11:37:33 AM by LeYoyo »
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
I'm glad you fixed the wrong stuff yourself and I'm sorry for not being as helpful as you'd probably expect :(

Let us know if you need further help ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Thanks a lot for your help ;)
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
After a few days to use, I have two issues.

1. During migration, all the post text that includes the '  caracter were changed to \\\'
Any idea how I could easy change all the \\\' in the messages by '  ?

2. I have several time the same error in the error log (the topicID can be different, it's not only for one topic):
http://myforum.com/forum/index.php?topic=205.0
512: loadMemberContext(): member id 2 not previously loaded by loadMemberData()
File: /myhomepages/forum/Sources/Load.php
Line: 1092


Any Idea/Help/Advice about that ?

Thanks in advance
« Last Edit: August 04, 2014, 05:36:25 AM by LeYoyo »
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Would this SQL commands in phpmyadmin work ?

UPDATE smf_messages SET body=REPLACE(body,'\\\','')

UPDATE smf_messages SET subject=REPLACE(subject,'\\\','')
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
That query should work, yes ;) Backup first, just in case ;)

As for your error, can you please attach your Load.php? Did you install any MODs? I've seen some errors on that but no specific solutions. Also, please make sure you run the maintenance tasks ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Here are the load.php and the installed mods.
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Can you please PM me an admin test account and a link to your forum so that I can have a look at that topic?
I have an idea on how to fix it but I need to see what's happening ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
OK, so I was able to replicate the problem and I understand why it happens now.

In SMF, when you delete an account (and choose not to delete this user's posts), all posts that he created are marked with "id_member" = 0 (in smf_messages table).

Apparently, IPB doesn't :P So your account ID=2 is a removed account, his posts were not deleted and IPB's posts table kept his ID associated with his posts. When you converted to SMF, the relevant tables were copied pretty much directly (no verification is performed) so this "detail" was also transferred.
When SMF shows you a topic, it loads also, for each post, its author's details. If the post's author ID is 0, then it's a guest and only "poster_name" is shown. If the ID is != 0, then it tries to load the user's details. Well, if the user was removed, the details cannot be found :)
So, this is your issue, apparently: your "smf_messages" table has posts recorded from users that no longer exist.

This can automagically be fixed by SMF if you run the Maintenance Task "Find and repair any errors". For example, in my test forum where I deliberately caused this error:
Quote
The following errors are fouling up your forum:
    Message #11 was posted by member #4, who is now missing.
Of course, a good database backup should be performed first. Just in case :P
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #43 on: September 05, 2014, 10:38:52 AM »
Everything work fine now.

Many thanks for the help !
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #44 on: September 05, 2014, 10:40:49 AM »
Nice :)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #45 on: September 06, 2014, 02:22:23 AM »
Humm, I was happy to early...

After double check, in all the topics, the ' caracter is now indicated as
Code: [Select]
&# 39;
:/
« Last Edit: September 06, 2014, 09:27:39 AM by LeYoyo »
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #46 on: September 06, 2014, 03:06:11 AM »
Can you give an example?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #47 on: September 06, 2014, 09:25:52 AM »
http://www.jihell.com/forum/index.php/topic,9709.0.html

first message (as example). Maybe the cause could be the two update queries mentionned above to replace the \\\' by ' in the smf_message table...

The \\\ are gone, but the ' seems to be replaced too...
Sous SMF 2.0.8

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #48 on: September 08, 2014, 07:51:53 AM »
As screenshot all this codes should be a '
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #49 on: September 09, 2014, 03:38:33 PM »
I assume that happened due to some collation stuff. Please check the table smf_messages, find your affected post (one of them) and see what shows up in the column "body".

In my test board, if I write this:
Quote
Quelq&# 39;un
My  database has:
Code: [Select]
Quelq&#38;# 39;un
Edit: you can try this in "SQL" tab: (remember to BACKUP first)
Code: [Select]
UPDATE smf_messages SET body = REPLACE(body, '&#38;# 39;','\'')In my test forum it worked.
« Last Edit: September 09, 2014, 03:50:06 PM by margarett »
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #50 on: September 10, 2014, 02:05:49 PM »
I tried your update query, It changed 1 line.

I changed the code and ran this one :
Code: [Select]
UPDATE smf_messages SET body = REPLACE(body, '&# 39;','\'')
And now, after a first look, it seems to be OK !!!

I will continue the checks. But I think the goal is not very far.  I usually try to do most of the things by myself (the best way to learn) but sometime, know how is really missing...

Thanks for the many help and effort you did !

Regards
Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #51 on: September 10, 2014, 02:18:45 PM »
Cool :)
Let us know if you need further help ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #52 on: September 12, 2014, 06:48:30 AM »
found another issue (but I don't know what to do in this case) It looks like every 0 (zero) were dropped from the subject/body..

As exemple, in the sale part of the forum, a price was 550€ and now : 55 €... A camera reference was Canon 400D and now Canon 4  D

Sous SMF 2.0.8

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #53 on: September 12, 2014, 07:56:02 AM »
:o

That's odd. Is it like that also in the database? A 0 shouldn't get into collation problems...
No idea, sorry...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline LeYoyo

  • Jr. Member
  • **
  • Posts: 251
Re: 2.0.0 to SMF: Converting members...Wrong value type sent to the database.
« Reply #54 on: September 12, 2014, 08:25:59 AM »
Yes, just checked in the DB :

"Neuf 4  € vendu 18 €"

Should be "Neuf 400€ vendu 180€". Means that the 0 were replaced by spaces. May be this happens when I tried to correct the '  issue...

I will check the different backups I did during the process. May be I will find when the problem appears (even if it's to late to fix it :/ )
Sous SMF 2.0.8