Dompdf: PCRE JIT compilation may fail due to memory exhaustion

Created on 12 Nov 2018  路  2Comments  路  Source: dompdf/dompdf

When running with PHP master (currently 7.4 dev) the following warning may be thrown:

preg_match(): JIT compilation failed: no more memory

Where preg_match could be any PCRE function.

So far I have encountered this error in the following instances:

  1. when running the testParseDataUriBase64Image unit test
  2. parsing the document encoding in the Dompdf class
bug

Most helpful comment

Temporary work around is the disable the PCRE JIT when using Dompdf. The configuration option pcre.jit is available starting with PHP 7.

All 2 comments

Temporary work around is the disable the PCRE JIT when using Dompdf. The configuration option pcre.jit is available starting with PHP 7.

The current implementation globally changes the JIT setting. I'm moving the logic into a run-time configuration change helper moving forward, but would like to explore the possibility of disabling for specific PCRE expressions or, if not, to modify the relevant code to avoid the issue.

Was this page helpful?
0 / 5 - 0 ratings