PCRE has not been compiled with Unicode support. (2011年03月31日の記事転載)
CakePHP 1.3.8のインストール時に見慣れない表示がでました。
PCRE has not been compiled with Unicode support.
あれ!?こんな表示あったっけな!?とういうことで調べてみたら
PCRE (Perl Compatible Regular Expressions)ライブラリのコンパイルオプションでunicode-propertiesが有効になっていないとダメらしい
ということで早速確認
$ pcretest -C
結果は以下
PCRE version 6.6 06-Feb-2006
Compiled with
UTF-8 support
No Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack
確かにNo Unicode properties supportとなっていますね
以下対応方法
# wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/pcre-6.6-2.el5_1.7.src.rpm
# rpm -ivh pcre-6.6-2.el5_1.7.src.rpm
警告が出ても無視して大丈夫です
# vi /usr/src/redhat/SPECS/pcre.spec
%configure --enable-utf8 --enable-unicode-properties
太字部分を追加
# rpmbuild -ba /usr/src/redhat/SPECS/pcre.spec
# rpm -Uvh /usr/src/redhat/RPMS/i386/pcre-6.6-2.7.i386.rpm
あとはApacheを再起動すれば黄色い警告は消えているはずです
使用しているサーバーによっては上記の方法がとれない場合もあると思いますので
その場合はcakeのalphaNumericのvalidationがPCREを使用しているそうなので
該当部分を修正してあげればいいようです。
こちらの方法は試してません・・・
cake/libs/validation.php
function alphaNumeric($check) { $_this =& Validation::getInstance(); $_this->__reset(); $_this->check = $check; if (is_array($check)) { $_this->_extract($check); } if (empty($_this->check) && $_this->check != '0') { return false; } //$_this->regex = '/^[\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]+$/mu'; $_this->regex = '/^[a-z\d]*$/i'; return $_this->_check(); }