MODxで「無効なチャンク名です」
環境 |
---|
FreeBSD 10.0-RELEASE-p4 |
PHP 5.4.23 |
MODX Revolution 2.2.10-pl (traditional) |
チャンクやスニペットが保存できない、または拡張のインストールが失敗するといった現象が起きたら、 PHPのログに以下のようなエラーが出ていないか確認する。
PHP warning: preg_match(): Compilation failed: invalid range in character class at offset 38
エラーの原因と解決方法は次のスレッドの通り。 http://forums.modx.com/thread/89848/solved-problem-with-formit-2-2-0-php-warning-preg-match
クソ意訳すると、正規表現の "-" 文字の扱いがPHPバージョンによって異なることが原因のため、
change in the following files : core/model/modx/mysql/modsnippet.map.inc.php core/model/modx/mysql/modchunk.map.inc.php this rule => '/^(quergo!\s)[a-zA-Z0-9\x2d-\x2f\x7f-\xff_-\s]+(quergo!\s)$/' by this rule => '/^(quergo!\s)[a-zA-Z0-9\x2d-\x2f\x7f-\xff-_\s]+(quergo!\s)$/
のように正規表現を変更するか、またはPHPのバージョンを変えればOKなんだって。
どのPHPのバージョンで発生するかは不確か。