Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: w4rkr4f7 on October 03, 2015, 09:32:12 AM

Title: RemoveTopic.php error
Post by: w4rkr4f7 on October 03, 2015, 09:32:12 AM
Hi ,if I try to restore a message from Recycle Bin is giving me a error at line 1311 and message is not moving.

I have replaced in RemoveTopic.php


// Time to move the messages.
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET
id_topic = {int:target_topic},
id_board = {int:target_board},
WHERE id_msg IN({array_int:msgs})',
array(
'target_topic' => $target_topic,
'target_board' => $target_board,
'msgs' => $msgs,
)
);



with:


// Time to move the messages.
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET
id_topic = {int:target_topic},
id_board = {int:target_board},
icon = {string:icon}
WHERE id_msg IN({array_int:msgs})',
array(
'target_topic' => $target_topic,
'target_board' => $target_board,
'icon' => $target_board == $modSettings['recycle_board'] ? 'recycled' : 'xx',
'msgs' => $msgs,
)
);



Now message is moving and no more errors...
Title: Re: RemoveTopic.php error
Post by: Illori on October 03, 2015, 10:35:24 AM
what error did you get?

i just tried to restore a topic and had no issues.
Title: Re: RemoveTopic.php error
Post by: Oldiesmann on October 04, 2015, 06:14:13 PM
I can't see how that change would fix an error unless the icon column was empty for some reason (which should never happen to begin with).
Title: Re: RemoveTopic.php error
Post by: live627 on October 04, 2015, 06:38:47 PM
What is the error?
Title: Re: RemoveTopic.php error
Post by: w4rkr4f7 on October 05, 2015, 09:20:01 AM
Quote from: live627 on October 04, 2015, 06:38:47 PM
What is the error?

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 'WHERE id_msg IN(19)' at line 5
File: /home/public_html/Sources/RemoveTopic.php
Line: 1311
Title: Re: RemoveTopic.php error
Post by: Kindred on October 05, 2015, 09:59:03 AM
And have you made any changes to the default code yourself (in any of the files, not just that one)?
Title: Re: RemoveTopic.php error
Post by: w4rkr4f7 on October 05, 2015, 10:04:27 AM
Quote from: Kindred on October 05, 2015, 09:59:03 AM
And have you made any changes to the default code yourself (in any of the files, not just that one)?

If I'm changing codes posted on first message of this topic error is gone and topic is moved ,anyway I just posted that just for other users having same error (maybe I'm only one with bad luck..)
Title: Re: RemoveTopic.php error
Post by: Kindred on October 05, 2015, 10:27:14 AM
you have missed the point of my question.

You ahve reported a bug.

Per Oldiesmann -- your edit should have no effect unless the icon column was empty.

That should never happen.

We can not recreate your error on a clean installation.

So... you are encountering and error that should not happen and can not be recreated...   
I am asking you -- have you edited ANY of the files for 2.1beta2?  Not just the "fix" which you posted above --- have you made ANY OTHER EDITS - TO ANY FILE?
Title: Re: RemoveTopic.php error
Post by: live627 on October 06, 2015, 01:10:39 AM
Extra comma on the line highlighted https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/Sources/RemoveTopic.php#L1304
Title: Re: RemoveTopic.php error
Post by: Oldiesmann on October 13, 2015, 12:36:35 PM
Fixed on GitHub: https://git.io/vCgGD