Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: RayRay26 on August 13, 2011, 04:33:36 PM

Title: [4905] Extra Signature Space Bug
Post by: RayRay26 on August 13, 2011, 04:33:36 PM
I found out that you can go above 500 characters in your signature for one edit. I had an urge to see if you could just remove part of a Simple Machines url and see if it worked like any url. It's temporary though, leaving you with having to redo some stuff. It has to be a Simple Machines forum (or the forum you are on) url though.
That's because it adds back in http://www.simplemachines.org/community/index.php into your signature, BUT it doesn't delete any of the extra at the end, leaving you with an extended signature. (if you edit your sig again, you'll see the extra text is already deleted, but that doesn't mean it's gone (until you update again as it is))

I did do a search on this board about this and didn't find it.
Title: Re: Extra Signature Space Bug
Post by: emanuele on August 15, 2011, 08:28:38 AM
Hi RayRay26!

Thanks for the report.
Could you please explain what do you mean with "the extra at the end"? (a screenshot would be useful)
Title: Re: Extra Signature Space Bug
Post by: emanuele on August 28, 2011, 12:31:09 PM
/me sometime is completely blind...or simply doesn't read everything... :P

Now I got it.
Yes, I think it can be considered a bug.
Title: Re: Extra Signature Space Bug
Post by: Illori on November 18, 2011, 10:11:52 AM
then can you report it?
Title: Re: [4905] Extra Signature Space Bug
Post by: emanuele on March 08, 2012, 06:52:24 AM
Looking into this.

The simplest way to fix it I can think of is to...preparse it twice...

Code (find) Select
// Too long?
if (!empty($sig_limits[1]) && $smcFunc['strlen']($unparsed_signature) > $sig_limits[1])
{
$_POST['signature'] = trim(htmlspecialchars($smcFunc['substr']($unparsed_signature, 0, $sig_limits[1]), ENT_QUOTES));


Code (replace with) Select

// Lenght is something particular...unfortunately...
$unparsed_signature_length = $unparsed_signature;
preparsecode($unparsed_signature_length);
$unparsed_signature_length = str_replace('<br />', "\n", $unparsed_signature_length);

// Too long?
if (!empty($sig_limits[1]) && $smcFunc['strlen']($unparsed_signature_length) > $sig_limits[1])
{
$_POST['signature'] = trim(htmlspecialchars($smcFunc['substr']($unparsed_signature_length, 0, $sig_limits[1]), ENT_QUOTES));


I'm wondering if it is worth.

Opinions?
Title: Re: [4905] Extra Signature Space Bug
Post by: Spuds on March 08, 2012, 07:40:53 PM
Not sure if this is a bug or a tip / trick

Seems like a pretty narrow case, if I'm reading it right,  where it has to be a forum link that SMF knows to 'fix' the link to cause the overflow on the save.  I don't think its worth the fix, especially since its a bit ugly  :D
Title: Re: [4905] Extra Signature Space Bug
Post by: emanuele on March 10, 2012, 04:40:21 PM
Let's say there are other cases (like /me and most likely img in certain conditions, etc.).

Yes, the fix workaround is a bit ugly.
Title: Re: [4905] Extra Signature Space Bug
Post by: emanuele on March 13, 2012, 08:03:42 PM
Much cleaner version:
}

preparsecode($value);
// Too long?
if (!allowedTo('admin_forum') && !empty($sig_limits[1]) && $smcFunc['strlen'](str_replace('<br />', "\n", $value)) > $sig_limits[1] && !)
{
$_POST['signature'] = trim(htmlspecialchars(str_replace('<br />', "\n", $value), ENT_QUOTES));
$txt['profile_error_signature_max_length'] = sprintf($txt['profile_error_signature_max_length'], $sig_limits[1]);
return 'signature_max_length';
}
return true;
}


moved the length check at the end (not shortened because there is javascript client side that will do).
Title: Re: [4905] Extra Signature Space Bug
Post by: Spuds on March 13, 2012, 10:00:27 PM
Yup ... much cleaner :)
Title: Re: [4905] Extra Signature Space Bug
Post by: emanuele on March 14, 2012, 05:27:35 AM
Speaking of which, I have always found pretty annoying the javascript that cuts out the last bit of the signature when is too long.
Wouldn't be much nicer and less destructive a red border around the box and an error box at the top?