smalot / pdfparser

PdfParser, a standalone PHP library, provides various tools to extract data from a PDF file.
GNU Lesser General Public License v3.0
2.37k stars 537 forks source link

Attempt to fix #659 (gzuncompress(): data error) #690

Closed k00ni closed 5 months ago

k00ni commented 6 months ago

Type of pull request

About

This PR is about the error in #659 (gzuncompress(): data error). Will fix #659

@NickHahac Currently I try to exploit the error, but your test data is not working (binary?). Could help me with the unit test?

Checklist for code / configuration changes

In case you changed the code/configuration, please read each of the following checkboxes as they contain valuable information:

k00ni commented 6 months ago

I googled for a while, but was not able to create an example to let gzuncompress run into the data error problem. Unfortunately, the code you posted doesn't work for me still (used PHP 7.4.x):

$data = '�s��8�S4z�2A�ٮ��������n�O���)q,�ӕ�ik�7l�B:��<Lgz?��C�/�UL�"XZ�@���ui~-�����٥~�&K��"&8_�E����A�f***@***.***�Kj��s����!3�Q�<�������#ŀ>�����3�|�L';

Maybe the characters got altered when pasting them inside an issue-textbox here?

My last idea is you create a pull request against the branch fix/issue-659-gz-uncompress-data-error (https://github.com/smalot/pdfparser/tree/fix/issue-659-gz-uncompress-data-error) and add your data here so the test triggers the data error warning: https://github.com/smalot/pdfparser/pull/690/files#diff-235727ecb69058b18625467133a4011eedea250a8842a96ae4c6e9c1b4f372cdR151-R155


Altogether, I am still wondering why the E_WARNING is not suppressed by @ before gzuncompress.

k00ni commented 6 months ago

They changed the behavior of the STFU operator @ in PHP 8.0, based on https://php.watch/versions/8.0/fatal-error-suppression

But still, it should silence E_WARNINGs like "data error".

k00ni commented 5 months ago

@NickHahac: I am inclined to close this (and maybe #659 too) because we can't reproduce it.

k00ni commented 5 months ago

Closed due to inactivity.