Comment error

0 views
Skip to first unread message

Michael Heilemann

unread,
Sep 22, 2008, 4:10:55 PM9/22/08
to habar...@googlegroups.com
I think I might've brought this up before, but I can't find the answer, so...
I activated comments on my site today, and tried a test comments;
which yielded this wonderful error:

Warning: preg_match() [function.preg-match]: Compilation failed:
support for \P, \p, and \X has not been compiled at offset 2 in
system/classes/feedbackhandler.php line 85

system/classes/feedbackhandler.php line 85:
preg_match( ...1 args... )
system/classes/actionhandler.php line 33:
FeedbackHandler->act_add_comment( )
system/classes/controller.php line 167:
ActionHandler->act( ...1 arg... )
index.php line 221:
Controller::dispatch_request( )

Any ideas?
--
Michael Heilemann
http://binarybonsai.com

Chris J. Davis

unread,
Sep 22, 2008, 4:17:49 PM9/22/08
to habar...@googlegroups.com
Whaaaaat?

Ali B.

unread,
Sep 22, 2008, 4:27:27 PM9/22/08
to habar...@googlegroups.com
This is not an issue in Habari. This is a problem with your host setup. They seem to have an old (or bizarrely compiled) version of the PCRE library.
--
Ali B / dmondark
http://www.awhitebox.com

rick c

unread,
Sep 22, 2008, 4:28:30 PM9/22/08
to habari-dev
You have brought this up before, Michael. From what I've been able to
understand, this is caused by a lack of utf-8 support in your host's
pcre library.

Rick

Chris Meller

unread,
Sep 22, 2008, 5:56:10 PM9/22/08
to Habari - Dev
You still need to upgrade your version of PCRE on the server. Your
phpinfo still says you're using version 6.

Sent from my iPhone

On Sep 22, 2008, at 4:10 PM, "Michael Heilemann" <heil...@gmail.com>
wrote:

>

mikelietz

unread,
Sep 22, 2008, 10:07:15 PM9/22/08
to habari-dev
If, however, upgrading is not an option, then you can override those
class files. Here's what worked for me and my unhelpful host.

Before we get started, doing this means any updates to the files in /
system do not carry over to your new copies. After each update you do
to /system you may need to delete and redo these files.

Any time you encounter that sort of PCRE error, copy the file
mentioned from /system/classes to /user/classes.
So what you'd do would be to copy feedbackhandler.php. I've needed to
tweak that one in the past (my host won't update past the 2003
version, leaving me out of the wonderful world of Unicode), and my
tweak was to comment that entire if statement.

/* if ( preg_match( '/^\p{Z}*$/u', $this-
>handler_vars['content'] ) ) {
Session::error( _t( 'Comment contains only
whitespace/empty comment' ) );
Utils::redirect( $post->permalink );
exit();
}
*/

If you're better versed in the regex options, it should be easy enough
to massage that statement. Make sure to comment what you do, so it's
easier to duplicate later.

Here's a better example, perhaps. Because of my aforementioned Unicode
troubles, I also need to tweak posts.php and utils.php (try doing any
search to see if this affects your site), and

posts.php:
/* working line */
preg_match_all( '/(?<=")(\\w[^"]*)(?=")|(\\w+)/',
$paramset['criteria'], $matches );
// /* non working line */
preg_match_all( '/(?<=")([\p{L}\p{N}]+[^"]*)(?=")|([\p{L}\p{N}]+)/u',
$paramset['criteria'], $matches );

utils.php:
/* working line */ $slug= rtrim( strtolower( preg_replace( '/[^a-
z0-9%_\-]+/i', $separator, $string ) ), $separator );
// /* non working line */ $slug=
rtrim( MultiByte::strtolower( preg_replace( '/[^\p{L}\p{N}%_\-]+/u',
$separator, $string ) ), $separator );

You'll either want to use /* comments around the entire old statement
*/ or make sure it doesn't wrap like this probably did here. The rest
of the file leave alone.

It's not exactly elegant, but it's a nice option to have and I'm glad
ringmaster steered me toward it many revisions ago, lest I stop being
able to update.

mikelietz

On Sep 22, 5:56 pm, Chris Meller <ch...@doesnthaveone.com> wrote:
> You still need to upgrade your version of PCRE on the server. Your  
> phpinfo still says you're using version 6.
>
> Sent from my iPhone
>
> On Sep 22, 2008, at 4:10 PM, "Michael Heilemann" <heilem...@gmail.com>  
Reply all
Reply to author
Forward
0 new messages