• Welcome to Simple Machines Community Forum. Please login or sign up.
December 01, 2021, 06:25:14 PM

News:

Wondering if this will always be free?  See why free is better.


[2.0] Modify Board Other Character Sets SMF 2.0.15

Started by vbgamer45, March 06, 2019, 08:41:18 PM

Previous topic - Next topic

vbgamer45

In certain cases when modifying a board with certain character sets will make the board name disappear and then unable to modify the board since it is blank
Issue Non SMF version of htmlspecialchars was used


Sources\ManageBoards.php(418)

$context['board']['name'] = htmlspecialchars(strtr($context['board']['name'], array('&' => '&')));
$context['board']['description'] = htmlspecialchars($context['board']['description']);

Change to

$context['board']['name'] = $smcFunc['htmlspecialchars'](strtr($context['board']['name'], array('&' => '&')));
$context['board']['description'] = $smcFunc['htmlspecialchars']($context['board']['description']);

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

No good deed goes unpunished
All helpful urges should be circumvented

vbgamer45

I tested on PHP 7.1.x
elkarte was doing this on that line

$context['board']['name'] = htmlspecialchars(strtr($context['board']['name'], array('&' => '&')), ENT_COMPAT, 'UTF-8');
$context['board']['description'] = un_preparsecode($context['board']['description']);
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

Let me guess, you're not running UTF-8 (the default for htmlspecialchars since 5.4)
No good deed goes unpunished
All helpful urges should be circumvented

vbgamer45

Guess not in my php.ini the default is empty it is commented out

; PHP's default character set is set to empty.
; http://php.net/default-charset
;default_charset = "UTF-8"
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro


shawnb61

Confirmed.  Issue is specifically with 4-byte characters, e.g.: 𣎏 世 咹 水 晶 𦓡 空 𣎏 害 咦

Issue also exists with category names, but at least you can update & fix the categories.  You cannot fix the board names. 

Logged as #75

2.1 works properly.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Arantor

This is because it doesn't use $smcFunc's version of htmlspecialchars that dos multibyte fixing.
No good deed goes unpunished
All helpful urges should be circumvented

shawnb61

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Advertisement: