Kroc / NoNonsenseForum

A free, open source, PHP-based simple discussion forum. It favours removing barriers to conversation rather than massaging egos. Download Here: https://github.com/Kroc/NoNonsenseForum/archive/master.zip
http://camendesign.com/nononsense_forum
Other
247 stars 34 forks source link

Stop using `trim` when validating. #165

Closed Zegnat closed 11 years ago

Zegnat commented 11 years ago

Currently PHP’s trim is the only thing applied to submitted data such as user names. But this will not catch everything. Instead a replace like this might be used:

$string = preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $string);

H/t Markus Hedlund.

Kroc commented 11 years ago

Don't want to remove the Apple logo if people care to use it, but OK, this looks a straightforward enough bug, thanks for filing as always.

Zegnat commented 11 years ago

Don't want to remove the Apple logo if people care to use it […]

True. Instead of \pC you could use \pCc which includes things like tab, linefeed and carriage return. This way you will not strip \pCo, which is private use (including the Apple logo).