dealfonso / sapp

Simple and Agnostic PDF Document Parser in PHP - sign PDF docs using PHP
GNU Lesser General Public License v3.0
115 stars 30 forks source link

Signature calc with __TMP_FOLDER #13

Closed malamalca closed 2 years ago

malamalca commented 2 years ago

PHP 8 does not like creating temporary files in system's temp folder. A notice is issued: "tempnam(): file created in the system's temporary directory". This fix passes existing constant __TMP_FOLDER to PDFUtilFnc::calculate_pkcs7_signature() function. This fix prevents the notice above.

dealfonso commented 2 years ago

Hi,

first of all, thank you for detecting the problem.

Now, before accepting the merge, it seems that __TMP_FOLDER is not defined anywhere, so it raises an error:

image

So please fix it (by including a default definition to (e.g.) /tmp).

Thank you

malamalca commented 2 years ago

The constant definition is a part of base class. https://github.com/dealfonso/sapp/blob/7251b0f2ed838fb9b204426d9bd7f3da2c9f926d/src/PDFDoc.php#L52

dealfonso commented 2 years ago

Hi,

you are right. Sorry for not double-checking it.