Advertisement:

Author Topic: [4905] Extra Signature Space Bug  (Read 4013 times)

Offline RayRay26

  • Newbie
  • *
  • Posts: 1
[4905] Extra Signature Space Bug
« 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.
« Last Edit: December 12, 2011, 05:13:28 PM by emanuele »

Offline emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,056
  • Gender: Male
  • THERE'S JUST ME
Re: Extra Signature Space Bug
« Reply #1 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)
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.

Offline emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,056
  • Gender: Male
  • THERE'S JUST ME
Re: Extra Signature Space Bug
« Reply #2 on: August 28, 2011, 12:31:09 PM »
* emanuele sometime is completely blind...or simply doesn't read everything... :P

Now I got it.
Yes, I think it can be considered a bug.
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.

Offline Illori

  • Doc Coordinator
  • SMF Master
  • *
  • Posts: 33,885
Re: Extra Signature Space Bug
« Reply #3 on: November 18, 2011, 10:11:52 AM »
then can you report it?

Offline emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,056
  • Gender: Male
  • THERE'S JUST ME
Re: [4905] Extra Signature Space Bug
« Reply #4 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?
« Last Edit: March 08, 2012, 07:47:52 AM by emanuele »
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.

Offline Spuds

  • SMF Hero
  • ******
  • Posts: 1,798
  • Gender: Male
Re: [4905] Extra Signature Space Bug
« Reply #5 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

Offline emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,056
  • Gender: Male
  • THERE'S JUST ME
Re: [4905] Extra Signature Space Bug
« Reply #6 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.
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.

Offline emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,056
  • Gender: Male
  • THERE'S JUST ME
Re: [4905] Extra Signature Space Bug
« Reply #7 on: March 13, 2012, 08:03:42 PM »
Much cleaner version:
Code: [Select]
}

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).
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.

Offline Spuds

  • SMF Hero
  • ******
  • Posts: 1,798
  • Gender: Male
Re: [4905] Extra Signature Space Bug
« Reply #8 on: March 13, 2012, 10:00:27 PM »
Yup ... much cleaner :)

Offline emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,056
  • Gender: Male
  • THERE'S JUST ME
Re: [4905] Extra Signature Space Bug
« Reply #9 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?
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.