We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46971
    • 33 Posts
    Hi all,

    wanted to try out Modx. There were no problems with the installation. I already got my first template or better said markup to modx. But now, i cannot create any chunks or snippets! There does always occur an error by the name-field. (chunk_err_invalid_name) - in german it says "the name of the chunk is wrong". No matter if i write in capital letters, small letters, with special characters or without, long names or a short one. The error does occur all the time! With chunks and snippets. I did not get one of them sad

    Plase help.
    Best regards!
    • Check your database to make sure that all of the fields in the tables are of the same character set and collation as what is specified in your config.inc.php file, for example it may say
      $database_connection_charset = 'utf8';

      so your tables should have a collation something like the attached image.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 7371
        • 22 Posts
        I too have had this issue, been driving me absolutely crazy!!! I found a hack where you edit a couple files and swop two characters around on core/model/modx/mysql/modchunk.map.inc.php

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

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


        But i've now got even more serious issues where wayfinder and getResources output absolutely nothing?

        I've got ton's of modx site up and running with no problems like this before. This last week i've had nothing but issues with MODX Revolution 2.2.13-pl (traditional) with a fresh install, i'm using a very simple wayfinder call

        [[Wayfinder? &startId=`0`&level=`1`]]

        With 5 resources created just to test and get nothing output at all, same happens with GetResources?!

        Any ideas what could be causing this, do you happen to know what setup is best for wayfinder to run? Oddly i've updated other sites to the new version of modx and they wayfinder calls work ok on them, I think this is due to it being updates and not first time installs on the new version?

        Lee

        • With PHP regular expressions, you can't have the - character in an expression unless it's at the end, or it thinks it's the range operator. If you put the - character anywhere else, it has to be escaped. Some versions of PHP appear to have a problem with it in any location, so it's better to escape it.
          'rule' => '/^(?!\\s)[a-zA-Z0-9\\x2d-\\x2f\\x7f-\\xff\-_\\s]+(?!\\s)$/',

            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 46971
            • 33 Posts
            I think it has to do with the php-version. Chunks and snippets work under the php-version 5.1.6. But then i cannot open the ressources, not even the ressource-tree. Under the version 5.5.10 i can open the ressources, but then i am not able to create any new chunks or snippets.

            working under that circumstances is impossible.
              • 8168
              • 1,118 Posts
              Did anyone manage to resolve this yet? I have an issue on a site that never had an issue before where i now cant create a new chunk... always get a CHUNK NAME IS INVALID error... huh?
                • 3749
                • 24,544 Posts
                This is usually due to a PHP upgrade by your host. Some newer PHP versions have a new regular expression engine that has trouble with some of MODX's existing regex code for validating element names.

                You could ask the host to back off the version for you if you can't find a way to fix the regex as described above by Sottwell.
                  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
                  • 31104
                  • 108 Posts
                  Awesome, finally fixed this issue, definitely saving this to my favorites tab, thanks Susan.