Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: chadon on May 15, 2022, 06:51:26 AM

Title: Custom Profile Fields errors
Post by: chadon on May 15, 2022, 06:51:26 AM
I have text custom profile fields setup on my forum with "no HTML" input masks but since the 2.1.2, the forum gives a "no HTML allowed" message when an user tries to modify his profile when he has a character with an accent like "é".
These custom profile fields have been set years ago so it will impact most users and we never had this issue before.

Title: Re: Custom Profile Fields errors
Post by: Steve on May 15, 2022, 09:16:56 AM
And you're on UTF-8?
Title: Re: Custom Profile Fields errors
Post by: hungarianguy on May 15, 2022, 09:42:24 AM
For forums with languages with special characters like hungarian having utf8 is a must.
Title: Re: Custom Profile Fields errors
Post by: chadon on May 15, 2022, 10:24:26 AM
Yes it is.
Title: Re: Custom Profile Fields errors
Post by: Doug Heffernan on May 15, 2022, 11:41:50 AM
Quote from: chadon on May 15, 2022, 06:51:26 AMbut since the 2.1.2,

I take it that it worked before. What version did you upgrade from?

What about this?

Quote from: Steve on May 15, 2022, 09:16:56 AMAnd you're on UTF-8?
Title: Re: Custom Profile Fields errors
Post by: Steve on May 15, 2022, 12:21:21 PM
He did say he was on UTF-8 Doug, unless he was replying to hungarianguy.  :)
Title: Re: Custom Profile Fields errors
Post by: Arantor on May 15, 2022, 12:30:41 PM
So this is a behaviour that changed in SMF 3 months ago in a bid to fix PHP 8.1 support but I think it's gone awry because it's failing on a comparison that's probably no longer true at this point in time if you have anything with accented letters in it.

Specifically it's this part of Profile-Modify.php:

if ($row['mask'] == 'nohtml' && ($valueReference != strip_tags($valueReference) || $value != filter_var($value, FILTER_SANITIZE_FULL_SPECIAL_CHARS) || preg_match('/<(.+?)[\s]*\/?[\s]*>/si', $valueReference)))
{
if ($returnErrors)
$errors[] = 'custom_field_nohtml_fail';

else
$value = '';
}

The fact that this has broken existing valid cases would suggest to me it is a bug.
Title: Re: Custom Profile Fields errors
Post by: chadon on May 15, 2022, 03:07:08 PM
Quote from: Doug Heffernan on May 15, 2022, 11:41:50 AMI take it that it worked before. What version did you upgrade from?
I updated from 2.1.1 to 2.1.2

Quote from: Doug Heffernan on May 15, 2022, 11:41:50 AMWhat about this?
I am on UTF-8

Quote from: Steve on May 15, 2022, 12:21:21 PMHe did say he was on UTF-8 Doug, unless he was replying to hungarianguy.  :)
My reply was for both of them.  ;D
Title: Re: Custom Profile Fields errors
Post by: Oldiesmann on May 15, 2022, 04:09:09 PM
Confirmed to be a bug. Same thing happens on my test board (2.1.2, PHP 8.1)
Title: Re: Custom Profile Fields errors
Post by: Oldiesmann on May 18, 2022, 08:42:03 PM
Forgot to edit my previous post, but this is tracked on GitHub: https://github.com/SimpleMachines/SMF/issues/7465
Title: Re: Custom Profile Fields errors
Post by: shawnb61 on November 25, 2022, 03:38:25 PM
Fixed in 2.1.3.