Fatal error: escapeshellarg(): Input string contains NULL bytes
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 579
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
This is maybe more of a PHP question than pdfparser one but here it goes anyway:
Important part of my code:
$parser = new \Smalot\PdfParser\Parser();
$pdf = $parser->parseFile($file_path);
$pages = $pdf->getPages();
foreach ($pages as $page) {
$text = $page->getText();
$stringWithoutNewLine = str_replace("\n"," ",escapeshellarg($text));
//some more code
}
And this returns the error in the title. Sure enoguh, I think some of the pages in my .pdf have only images, no text.
I would like to get an empty string if there is no text on the page.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported call path through Parser::parseFile(), getPages(), and each page's getText() result, then inspect how image-only pages are represented. Reproduce the NULL-byte failure using a PDF page without text and determine the expected empty-string behavior before identifying where a regression test belongs.
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
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100