[dokuwiki] Re: preg_match() Compilation failed: regular expression too large...

  • From: "Harry Fuecks" <hfuecks@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 21 May 2007 23:47:51 +0200

On 5/21/07, Jaume Obrador <obrador@xxxxxxxxxxxx> wrote:
Hi, I try to use dokuwiki together with dokutexit plugin to generate a
PDF file from some pages. I may say that it works great with a few
pages, but the problem comes when I try to generate a PDF from a larger
number of pages, total Kb of those pages together are 209K. I get the
following error 22 times:

        Warning: preg_match() [function.preg-match]: Compilation failed:
        regular expression too large at offset 0
        in /var/www/lledoner/dokuwiki/inc/parser/lexer.php on line 115

I increased the default php memory_limit from 8M to 32M, with no good
results.

That's a limitation of PCRE not PHP - see http://www.pcre.org/pcre.txt
section "LIMITATIONS": "The maximum length of a compiled pattern is
65539 (sic) bytes  if  PCRE
      is compiled with the default internal linkage size of 2."

It goes on to say you can compile PCRE differently to get round this
but that will probably get interesting with PHP, where PCRE is part of
the core distribution.

Without knowing more I'd say this problem _isn't_ directly caused by
trying to generate a PDF from many pages, because the size of the
parser regex should not be dependent on the size of the document(s)
you are parsing.

To have this error possible causes might be;

- a very large smileys or acronyms file - last time I checked these
get turned into a single regular expression so a big input file could
lead to a regex > 65539 bytes. Normally though if the problem was
here, you'd see it on every page, not just the PDF version

- a plugin which _IS_ using the document to build further regular
expressions, in some way: list your plugins...

Hope that helps
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: