Search

I moved to a new server, and now I am getting this error when trying to create an entry by uploading a file using a Unique Upload Field (although I’m not sure it’s an error with that extension as such):

preg_match_all() [function.preg-match-all]: Compilation failed: PCRE does not support L, l, N, P, p, U, u, or X at offset 2
/var/www/html/rtfx/symphony/lib/toolkit/class.lang.php line 248

243
244         // Strip out any tag
245         $string = strip_tags($string);
246
247         // Find all legal characters
248         $count = preg_match_all('/[p{L}w:;.,+=~]+/u', $string, $matches);
249         if($count <= 0 || $count == false){
250             preg_match_all('/[w:;.,+=~]+/', $string, $matches);
251         }
252

Seems like a difference in the PHP setup to me, what could I check?

Maybe this comment on php.net could help?

Right you are alpacaaa, it’s basically due to an older PHP version (which I cannot change, grr).

Since that piece of code already has a fall-back on the following line, I can simply suppress warnings from the preg_match_all function like so:

$count = @preg_match_all('/[\p{L}\w:;.,+=~]+/u', $string, $matches);

It works, but since this is modification to the core, I have to remember to re-apply it when I update Symphony (not ideal). Also I don’t know what will happen if trying to upload a file with Unicode chars in its filename…

Should this be filed a bug/possible improvement?

If your PHP version is pre 5.2, it is not a bug. Symphony’s officially requires PHP 5.2+.

Actually the PHP version on my server (where I encountered the problem) is 5.2.5, but the version of the PCRE library is listed as 4.5 01-December-2003 (as opposed to 8.00 2009-10-19 on my development machine, where everything worked fine)…

Sounds rather strange. PHP 5.2.0 should include PCRE 6.7 (see change log).

Yes, strange indeed, but that’s what phpinfo() reports.

Update: I asked my sysadmin about why we were using such an old version, and his reply was:

it’s very stable and supported by the RedHat security team

Well there’s nothing else I can do personally, but maybe we could add something about the PCRE version to Symphony’s list of requirements.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details