mittwald / typo3-web2pdf

A TYPO3 extension for rendering content as PDF
GNU General Public License v2.0
18 stars 20 forks source link

Error: Call to a member function stdWrapValue() on null #128

Closed robinson2 closed 2 years ago

robinson2 commented 2 years ago

On TYPO3 11.5.12 with web2pdf 3.0.0 I get the "Call to a member function stdWrapValue() on null" if the PDF-Link is cached. After clearing the FE-cache, the PDF will be delivered once normally. With the second call the error comes again.

robinson2 commented 2 years ago

Sorry, the error was on my side. I generated the link incorrectly.

infabo commented 1 month ago

I am experiencing the same behavior. Can you explain in more detail what was wrong with your link? Thanks

robinson2 commented 1 month ago

If my notes are correct, then that was my faulty attempt:

lib.pdfLink = TEXT
lib.pdfLink {
    value = PDF
    typolink{
        parameter.data = TSFE:id
        additionalParams = &tx_web2pdf_pi1[argument]=printPage
    }
}

I replaced that at the time with what now works:

lib.pdfLink = USER
lib.pdfLink {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    pluginName = Pi1
    extensionName = Web2pdf
    vendorName = Mittwald
    controller = Pdf
    action = generatePdfLink
}
infabo commented 1 month ago

Thank you for your feedback.

In the meantime, I've debugged it more thoroughly. It works via Pi1 because the generatePdfLink action is declared as uncached (see https://github.com/mittwald/typo3-web2pdf/blob/master/ext_localconf.php#L21).

As a result, the TSFE->cObj gets initialized - something that doesn't happen with a fully cached page - which in turn prevents an error in the PDF middleware. Otherwise, we encounter the issue we've both seen before: it works on the first call, but the second call throws an error with stdWrap on null (specifically, because TSFE->cObj is null).