I have the same problem and the solution you write worked also for me. My fear is that I should change this code every time MODx updates until this Bug is fixed.
Thank you edivad for share this.
This seems to work btw for anyone with similar issue...
Anyone had the same issue with Template Variables? A fix for that?? Why have these things broken by the way???
Just happened to me too, but it has been a while since I created a new chunk on this site and in the interim I've updated MODx a couple of times, now to 2.2.13 and my hosting firm has updated PHP a couple of times. Now at 5.4.33 with MySQL now up to 5.5.37.
I suspect, given the other postings in the topic, it's a PHP-version-dependent bug and I'm off to bug-reporting now to make sure someone's filed this one.
edivad's fix still works. [Thanks, edivad!]
MODX Revolution 2.6.5-pl (traditional)
Hosted on MODX Cloud
Skype: nicbaldeagle
Quote from: dubbs at Oct 03, 2014, 06:40 AMAnyone had the same issue with Template Variables? A fix for that?? Why have these things broken by the way???
MODX uses a fairly complex regular expression to make sure that object names contain no illegal characters. Newer versions of PHP have stricter parsing of regular expressions and throw a warning if they see one they don't like.
Updating MODX might fix the problem.
Also, I haven't tried it, but if you set the debug System Setting to 1, you may see an error message telling you the problem file and line number when you save a chunk.
Edit that line of the named file and put a backslash before the last minus sign (change the last - sign to \-).
I'd recommend making a backup copy of the file first, in case things go bad.
Had the same problem that disappeared with update to 2.2.14