-
Notifications
You must be signed in to change notification settings - Fork 538
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
Ignore encryption #653
Ignore encryption #653
Conversation
doc/Usage.md: - Moved description of `setIgnoreEncryption` option to doc/CustomConfig.md - Added brief "PDF encryption" section doc/CustomConfig.md: added `setIgnoreEncryption` option and section to describe it. src/Smalot/PdfParser/Config.php: Doc comment for Config::setIgnoreEncryption() Added tests/PHPUnit/Integration/EncryptionTest.php Added samples/not_really_encrypted.pdf (thanks to @parijke who orginially created this as test.pdf) See #653
PHP-CS-Fixer has been run successfully. All tests passing including new ones in tests/PHPUnit/Integration/EncryptionTest.php |
@k00ni Looks like there were pre-existing PHP-CS-Fixer violations in the code; I ignored those because I assumed they were OK. (And just fixed ones in files I added/changed.) Might have come from PR 632 commits. Any chance you could triage these, please? |
@unixnut thank you for this pull request. I am very busy these days, but I will try to get back to you until next week. Only skimmed your code, but it looks great so far. |
More re. PHP-CS-Fixer:
Except the one I fixed, I believe all of these are out of scope for the PR. |
CS related stuff doesn't really matter, because I will clean/correct it myself locally, if needed. The CI stuff is important and there are no problems in your code. Thank you for investing extra time on that 👍 |
Hi, @k00ni Sorry to bug you, but it looks like the PR is ready to approve. Any ideas when you will have merged it and released a new version? This is so I can give an update to my client. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason my Git was not able to push my local changes back into your branch, even though you allowed changes by maintainers. I had to make the changes by hand, therefore the messy history.
Summary:
- Adapted a few texts, only minor changes.
- Moved the tests into ParserTest, because a separate EncryptionTest class makes no sense at this point. Our tests need better organisation, but for now that the most practical solution I can think of.
Your pull request is not based on our latest master branch. I tried it locally and everything worked fine. Please check that next time.
I will merge it later this day and can prepare a new version. But it will be a release candidate, because we are in the middle of a big transition and watching how things are going.
@k00ni any idea why this was deprecated later on? Do we have a permanent fix? If yes, what is that? |
It was marked deprecated because our current implementation is incomplete/not working. In case of a false positive one can override the check setting the appropriate config value (we had a few issues with those already). In the future there might be someone who implements this part and then this config value can be removed. FYI: https://github.com/smalot/pdfparser/blob/master/doc/Usage.md#pdf-encryption |
Type of pull request
About
In some cases PDF files may be internally marked as encrypted even though the content is not encrypted and can be read.
This MR provides a config option to inform the PDF parser to ignore the encryption and attempt to read the PDF anyway.
This therefore provides a work around for the following issues:
Thanks to @DivineOmega for making the original pull request.
(PHP-CS-Fixer has not been run.)