News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

2.0.0 to SMF: Converting members...Wrong value type sent to the database.

Started by LeYoyo, June 05, 2014, 08:43:33 AM

Previous topic - Next topic

LeYoyo

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

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

LeYoyo

Sous SMF 2.0.8

margarett

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

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


margarett

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:
$row['signature'] = substr(strtr(strtr($row['signature'], '<>', '[]'), array('[br /]' => '<br />')), 0, 65534);
Add after:
$row['instant_messages'] = (int)$row['instant_messages'];
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

LeYoyo

Added here:

), 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

LeYoyo

Just wondering about one point : do I use the right converter ?
Sous SMF 2.0.8

margarett

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

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

LeYoyo

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

margarett

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

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

LeYoyo

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

Oldiesmann

"instant_messages" is the name of the column in SMF. It should be called "msg_total" in the IPB database.
Michael Eshom
Christian Metal Fans

LeYoyo

Sous SMF 2.0.8

margarett

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

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

LeYoyo

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

margarett

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

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

LeYoyo

Sous SMF 2.0.8

margarett

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

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


margarett

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

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

LeYoyo

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...)

$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 :
$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 ?
Sous SMF 2.0.8

margarett

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

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

LeYoyo

it don't work. I cannot find where to put the cast :/ for the id_poll

Any advice ?
Sous SMF 2.0.8

LeYoyo

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

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)
Sous SMF 2.0.8

LeYoyo

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

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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


margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

LeYoyo

Sous SMF 2.0.8

margarett

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)

/******************************************************************************/
--- 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

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

LeYoyo

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

LeYoyo

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 :
Sous SMF 2.0.8

LeYoyo

accent issue solved : I had to install the french package instead of the frenchUTF8 package
Sous SMF 2.0.8

LeYoyo

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 !

Sous SMF 2.0.8

margarett

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

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

LeYoyo

Sous SMF 2.0.8

LeYoyo

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
Sous SMF 2.0.8

LeYoyo

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

margarett

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

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

LeYoyo

Sous SMF 2.0.8

margarett

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

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

margarett

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:
QuoteThe 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

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

LeYoyo

Sous SMF 2.0.8

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

LeYoyo

Humm, I was happy to early...

After double check, in all the topics, the ' caracter is now indicated as &# 39;

:/
Sous SMF 2.0.8

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

LeYoyo

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

LeYoyo

Sous SMF 2.0.8

margarett

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:
QuoteQuelq&# 39;un
My  database has:
Quelq&#38;# 39;un

Edit: you can try this in "SQL" tab: (remember to BACKUP first)
UPDATE smf_messages SET body = REPLACE(body, '&#38;# 39;','\'')
In my test forum it worked.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

LeYoyo

I tried your update query, It changed 1 line.

I changed the code and ran this one :
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

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

LeYoyo

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

margarett

: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

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

LeYoyo

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

Advertisement: