We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8473
    • 3 Posts
    Hello,
    I have a new installation of modx 2.2.12 , when I try to create a new chunk I get this error:
    public_html/core/xpdo/validation/xpdovalidator.class.php : 82) PHP warning: preg_match(): Compilation failed: invalid range in character class at offset 38


    What is it?

    I use PHP 5.4.25

    Thanks.
      • 8473
      • 3 Posts
      Solved,
      I had the same issue that someone had with snippet creation process, and the solution is the same for the chunks.
      in the core/model/modx/mysql/modchunk.map.inc.php I have modified

      'rule' => '/^(?!\\s)[a-zA-Z0-9\\x2d-\\x2f\\x7f-\\xff_-\\s]+(?!\\s)$/',

      in
      'rule' => '/^(?!\\s)[a-zA-Z0-9\\x2d-\\x2f\\x7f-\\xff-_\\s]+(?!\\s)$/',


      Now appear working.
        • 12508
        • 63 Posts
        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.
          • 13730
          • 149 Posts
          Recently I had the same problem, PHP Warning: preg_match (): Compilation failed: invalid ranks in character class at offset 38.

          The problem was at the level of the PHP. My site was using PHP 5.4 CloudLinux. My host gave me back the PHP 5.4 (native) and everything is back to normal.

          Ref : http://forums.modx.com/thread/89848/installation-problem-with-formit-2-2-0#dis-post-493866
            • 8168
            • 1,118 Posts
            This seems to work btw for anyone with similar issue...
              • 8168
              • 1,118 Posts
              Anyone had the same issue with Template Variables? A fix for that?? Why have these things broken by the way???
                • 21395
                • 91 Posts
                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
                  • 3749
                  • 24,544 Posts
                  Quote from: dubbs at Oct 03, 2014, 11:40 AM
                  Anyone 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.

                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 9674
                    • 170 Posts
                    Had the same problem that disappeared with update to 2.2.14