Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FATAL ERROR in tcpdi_parser.php - Includes fix detail. #53

Open
RigidCollision opened this issue Jun 27, 2021 · 4 comments
Open

FATAL ERROR in tcpdi_parser.php - Includes fix detail. #53

RigidCollision opened this issue Jun 27, 2021 · 4 comments

Comments

@RigidCollision
Copy link

Was recieving the following error on 'some' merge requests:

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, bool given in C:\MyPath\www\PDFMerger\tcpdf\tcpdi_parser.php:503 Stack trace: #0 C:\MyPath\www\PDFMerger\tcpdf\tcpdi_parser.php(373): tcpdi_parser->decodeXrefStream() #1 C:\MyPath\www\PDFMerger\tcpdf\tcpdi_parser.php(212): tcpdi_parser->getXrefData() #2 C:\MyPath\www\PDFMerger\tcpdf\tcpdi.php(121): tcpdi_parser->__construct() #3 C:\MyPath\www\PDFMerger\tcpdf\tcpdi.php(88): TCPDI->_getPdfParser() #4 C:\MyPath\www\PDFMerger\PDFMerger.php(97): TCPDI->setSourceFile() #5 C:\MyPath\www\offline downloads\download-DL100.php(75): PDFMerger\PDFMerger->merge() #6 {main} thrown in C:\MyPath\www\PDFMerger\tcpdf\tcpdi_parser.php on line 503

Line 503 is:
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1] >= 2))) {

Changed to:
} elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) {

Please verify this change and update the release accordingly if fit for purpose. :)

@Courtsilius
Copy link

Thank you so much! This helped me since I had issues with bigger PDF files (more than 100 pages).

Additionally to that I added a check before the "switch ($predictor) {" on line 375, basically just

if(Count($row)<=$i){continue;}

somewhat hacky, but it works in my case, so leaving this just in case someone else might stumble on this c:

@Manitnelav
Copy link

Thank you so much!! You saved my day!

@RigidCollision
Copy link
Author

No Worries.
This could do with being addressed in the code and made part of a release?

@RigidCollision
Copy link
Author

RigidCollision commented Sep 23, 2022 via email

mikefox added a commit to ohgoodlord/PDFMerger that referenced this issue Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants