moving to 2.0 kills my udt on preg_replace

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
scotch33
Dev Team Member
Dev Team Member
Posts: 280
Joined: Tue Feb 14, 2006 9:56 pm

moving to 2.0 kills my udt on preg_replace

Post 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?
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: moving to 2.0 kills my udt on preg_replace

Post by Rolf »

It works for me. Turn on error displaying at your server, you might get an idea what goes wrong here...
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: moving to 2.0 kills my udt on preg_replace

Post by velden »

I'd suspect mod_security kicking in.
scotch33
Dev Team Member
Dev Team Member
Posts: 280
Joined: Tue Feb 14, 2006 9:56 pm

Re: moving to 2.0 kills my udt on preg_replace

Post by scotch33 »

Thanks Chaps.
It was indeed a generic rule within mod_security. Changing it has solved the issue.
Locked

Return to “CMSMS Core”