smalot / smalot/pdfparser

Compilation failed: regular expression is too large at offset

Open
#833 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
2.7k
Forks
579
Avg merge
2m
Merged PRs (30d)
1

Description

Hello,

I'm sorry, but https://github.com/smalot/pdfparser/issues/12, https://github.com/smalot/pdfparser/issues/668, or https://github.com/smalot/pdfparser/issues/709 are back again.

Trace:

In PDFObject.php line 310:
                                                                                              
  [ErrorException]                                                                            
  Warning: preg_match(): Compilation failed: regular expression is too large at offset 49021  
                                                                                              

Exception trace:
  at /var/www/vendor/smalot/pdfparser/src/Smalot/PdfParser/PDFObject.php:310
 Smalot\PdfParser\PDFObject->formatContent() at /var/www/vendor/smalot/pdfparser/src/Smalot/PdfParser/PDFObject.php:436
 Smalot\PdfParser\PDFObject->getSectionsText() at /var/www/vendor/smalot/pdfparser/src/Smalot/PdfParser/PDFObject.php:689
 Smalot\PdfParser\PDFObject->getTextArray() at /var/www/vendor/smalot/pdfparser/src/Smalot/PdfParser/PDFObject.php:668
 Smalot\PdfParser\PDFObject->getText() at /var/www/vendor/smalot/pdfparser/src/Smalot/PdfParser/PDFObject.php:802
 Smalot\PdfParser\PDFObject->getTextArray() at /var/www/vendor/smalot/pdfparser/src/Smalot/PdfParser/PDFObject.php:668
 Smalot\PdfParser\PDFObject->getText() at /var/www/vendor/smalot/pdfparser/src/Smalot/PdfParser/Page.php:232
 Smalot\PdfParser\Page->getText() at /var/www/src/Command/RulesIndexCommand.php:44
 App\Command\RulesIndexCommand->__invoke() at n/a:n/a
 ReflectionFunction->invoke() at /var/www/vendor/symfony/console/Command/InvokableCommand.php:62
 Symfony\Component\Console\Command\InvokableCommand->__invoke() at /var/www/vendor/symfony/console/Command/Command.php:281
 Symfony\Component\Console\Command\Command->run() at /var/www/vendor/symfony/console/Application.php:1144
 Symfony\Component\Console\Application->doRunCommand() at /var/www/vendor/symfony/framework-bundle/Console/Application.php:123
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/vendor/symfony/console/Application.php:379
 Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/framework-bundle/Console/Application.php:86
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:218
 Symfony\Component\Console\Application->run() at /var/www/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49
 Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /var/www/vendor/autoload_runtime.php:32
 require_once() at /var/www/bin/console:15

file: pandemie.pdf

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the attached pandemie.pdf, then inspect src/Smalot/PdfParser/PDFObject.php around line 310 and follow formatContent() through the stack trace. Determine how this PDF produces the oversized regular expression, and verify that parsing its text completes without the preg_match compilation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.