XML handle attribute outputs percent symbol after saving entry in Sym 2.7
cylkee opened this issue · 2 comments
Affected Symphony version(s) : 2.7.10
PHP version(s) : 7.3.12
OS(es) : Linux
To reproduce, use a core Text Field and input Hello % World
. Result in XML is handle="hello-%-world"
.
This does not appear to affect Sym 2.6.x, A similar test in Sym 2.6.11 saves as handle="hello-world"
.
I also have this.
The problem must be in this code:
https://github.com/symphonycms/symphonycms/blob/master/symphony/lib/toolkit/class.general.php#L350
preg_match_all('/[^<>?@:!\-\/\[-`;‘’…]+/u', $string, $matches);
changing it to the previous version fixes this:
preg_match_all('/[^<>?@:!-\/\[-`;‘’…]+/u', $string, $matches);
@wdebusschere Good spot, thanks.
I think the original version matches !
to /
, which includes "#$%&'()*+,-.
, but escaping the hypen stops matching those additional characters.
8d7df42#diff-7df0f022f38a40206c11fae6e6c5f0b9
FYI, @nitriques @michael-e
Looks like this matching was reversed for 3.0.0 9c43772, although I have not installed 3.0.0 yet.