Page 1 of 1

moving to 2.0 kills my udt on preg_replace

Posted: Tue Dec 12, 2017 5:45 pm
by scotch33
Upgrading a site from 1.x to 2.x has thrown up an issue with a UDT.

This issue is that on submit (in admin) the UDT fails to save and instead goes to a page not found error.

I have narrowed the issue down to a single line..

$today = date("Y-m-d G:i:s");
$title = $course_name." ".$firstname." ".$surname;
$title_clean = preg_replace("![^a-z0-9]+!i", "-", $title);
$title_nospace = str_replace(" ","_",$title_clean);
$alias = strtolower($title_nospace);

So for some reason preg_replace causes the udt to die. I need to find a workaround to give me the same results from that line. Can anyone advise an route to take?

Re: moving to 2.0 kills my udt on preg_replace

Posted: Tue Dec 12, 2017 7:29 pm
by Rolf
It works for me. Turn on error displaying at your server, you might get an idea what goes wrong here...

Re: moving to 2.0 kills my udt on preg_replace

Posted: Wed Dec 13, 2017 8:47 am
by velden
I'd suspect mod_security kicking in.

Re: moving to 2.0 kills my udt on preg_replace

Posted: Wed Dec 13, 2017 5:11 pm
by scotch33
Thanks Chaps.
It was indeed a generic rule within mod_security. Changing it has solved the issue.