bithost-gmbh / pdfviewhelpers

TYPO3 CMS extension that provides various Fluid ViewHelpers to generate PDF documents.
GNU General Public License v3.0
44 stars 20 forks source link

processingInstructions, no File in fileadmin/_processed_ generated #240

Open braukma opened 8 months ago

braukma commented 8 months ago

Hello, I am facing problems using the image view helper with some processingInstructions. The PDF generation fails with an exeption: Call to undefined method TYPO3\CMS\Core\Resource\ProcessedFile::setMissing() This refers to an access to a non existing file in fileadmin/processed

Much testing: Reason is, the file is never generated and therefore cannot be found.

I used something like processingInstructions="{width: '{size_veroeff}c'}" in my Code, that worked well with pdfviewhelpers 2.5.0

Removing that bit of code cured my problem, I wonder wether that's related to the changes that took place with the changes to the processingInstructions, user dumbness or whatever. :-)

Environment TYPO3 version v11.5 pdfviewhelpers version: v3.0.0

Best Regards,

Jürgen

maechler commented 8 months ago

@braukma Thanks for your report! I don't think it should be related to that change, but you never know, I will have to have a closer look. Apart from the pdfviewhelpers version there is no difference? It's exactly the same TYPO3 and Fluid version? Exactly the same template?

braukma commented 8 months ago

Thanks for the very quick response! :-)

OK, my longer story is told like this:

I started with Typo3, V9.5, pdfviewhelpers 4.5.0 and an extension by an external developer to produce that PDF-Booklet from within the backend of Typo. For obvious reasons, I migrated to Typo3 V11. To migrate from 9 to 11, I set up 9, 10 and 11 in a local install to update the database. Beeing lazy, I shared the whole of fileadmin with all versions by a symlink. I got an updated version for the PDF-export (that works in v11 and requires pdfviewhelpers 3.0.0) that worked well in my local install, but failed on my production install. Long, long search: It worked localy, because the files in question whre already there, generated long before with my very old 9.5 working install. Deleting fileadmin/processed reproduced that contition and deleting the processingInstruction in my partial cured it. Any chance for me to look deeper / help more?

Jürgen

maechler commented 8 months ago

Without further testing I think it could be a Fluid parsing issue because of the special syntax with the variable in the string processingInstructions="{width: '{size_veroeff}c'}". Could you try setting it to a fixed value instead?

e.g. processingInstructions="{width: '400c'}"

If that doesn‘t help it would be interesting if there was some error in the log files. Because you are upgrading TYPO3 as well, there might be several other problems causing this issue.

braukma commented 8 months ago

OK,

I edited my partial an replaced the processingInstructions as suggested. Then, I killed fileadmin/processed to make sure to delete the spoilers :-), aka to be sure there is nothing left to pop up from the nonexisting and started the Export:

Call to undefined method TYPO3\CMS\Core\Resource\ProcessedFile::setMissing()

Again, deleting the Instructions brought relief.

From the log: Core: Exception handler (WEB): Uncaught TYPO3 Exception: Call to undefined method TYPO3\CMS\Core\Resource\ProcessedFile::setMissing() | Error thrown in file /var/www/htdocs/typo3_src-11.5.33/typo3/sysext/core/Classes/Resource/ResourceStorage.php in line 753. Requested URL: [URL removed, if needed pse. tell me]

Is there more for me to scratch from the logs? I am a bit unexperienced with this sort of troubleshooting.

Jürgen

maechler commented 8 months ago

@braukma I just quickly tested the image processing with v3.0.0 and it seems to work as expected. Thus I suspect there is a general image processing issue with your TYPO3 instance.

Does the image processing work in other parts of the installation? You could run the checks in the backend under "Admin Tools" > "Environment" > "Image Processing" to see if image processing works in general.

braukma commented 8 months ago

Tried a bit again: cleared all in processed Generated my PDF with processingInstructions, static entry: The exeption occurs and an empty directory structure ./1/d is created in processed But no file(s) in that, just empty removed ./1/d in processed removed the processingInstruction tried to create the PDF: of course, that worked now no new files directories in fileadmin ---- 8< --- Played a bit in the frontend, called different Pages: fileadmin filles up with new generated directories and files (png) in it. I recon, these are generated from within Typo3 ---- 8< ---- Image Processing: Looks fine, all on my system looks like the reference, exept converting to webp throws a complaint.

Let's call it a day for now. I'll check further into that matter and pick up that thread a bit later, since I also have non Typo3 jobs on my agenda .... :-)

Jürgen

maechler commented 8 months ago

Looking at the TYPO3 core code in ResourceStorage I think it might be missing an !$isProcessedFile check where your error originates from:

https://github.com/TYPO3/typo3/blob/ddf15a5d1574c6431addfae1b1ed2e1df05bd5e7/typo3/sysext/core/Classes/Resource/ResourceStorage.php#L744-L747

However the question remains why this happens with your example. It could help if you added some debug statements in the ResourceStorage class just before the call to setMissing that leads to that error.

e.g.

if ($isProcessedFile) {
    var_dump($action);
    debug_print_backtrace();     
}

Also debugging some more properties of the file object could help here.