tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.23k stars 1.52k forks source link

undefined array key "n" #749

Open joesse opened 1 month ago

joesse commented 1 month ago

I am using tcpdf as a module in webtrees. On their demonstration installation, creating a PDF works fine, but in my installation I get this: `Undefined array key "n" …/vendor/tecnickcom/tcpdf/tcpdf.php:9103

0 …/vendor/tecnickcom/tcpdf/tcpdf.php(9103): Fisharebest\Webtrees\Webtrees::Fisharebest\Webtrees{closure}(2, 'Undefined array...', '/home/webpages/...', 9103)

1 …/vendor/tecnickcom/tcpdf/tcpdf.php(9026): TCPDF->_puttruetypeunicode(Array)

2 …/vendor/tecnickcom/tcpdf/tcpdf.php(9545): TCPDF->_putfonts()

3 …/vendor/tecnickcom/tcpdf/tcpdf.php(10062): TCPDF->_putresources()

4 …/vendor/tecnickcom/tcpdf/tcpdf.php(3068): TCPDF->_enddoc()

5 …/vendor/tecnickcom/tcpdf/tcpdf.php(7656): TCPDF->Close()

6 …/app/Report/PdfRenderer.php(399): TCPDF->Output('doc.pdf', 'S')

7 …/app/Report/ReportParserGenerate.php(483): Fisharebest\Webtrees\Report\PdfRenderer->run()

8 …/app/Report/ReportParserGenerate.php(338): Fisharebest\Webtrees\Report\ReportParserGenerate->docEndHandler()

9 …/app/Report/ReportParserBase.php(73): Fisharebest\Webtrees\Report\ReportParserGenerate->endElement(Object(XMLParser), 'Doc')

10 [internal function]: Fisharebest\Webtrees\Report\ReportParserBase->Fisharebest\Webtrees\Report{closure}(Object(XMLParser), 'Doc')

11 …/app/Report/ReportParserBase.php(87): xml_parse(Object(XMLParser), 'otnoteTexts />\n...', true)

12 …/app/Report/ReportParserGenerate.php(204): Fisharebest\Webtrees\Report\ReportParserBase->__construct('/home/webpages/...')

13 …/app/Http/RequestHandlers/ReportGenerate.php(117): Fisharebest\Webtrees\Report\ReportParserGenerate->__construct('/home/webpages/...', Object(Fisharebest\Webtrees\Report\PdfRenderer), Array, Object(Fisharebest\Webtrees\Tree))

14 …/app/Http/Middleware/RequestHandler.php(55): Fisharebest\Webtrees\Http\RequestHandlers\ReportGenerate->handle(Object(Nyholm\Psr7\ServerRequest))

15 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\RequestHandler->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

16 …/app/Module/HitCountFooterModule.php(154): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

17 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Module\HitCountFooterModule->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

18 …/app/Module/CheckForNewVersion.php(122): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

19 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Module\CheckForNewVersion->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

20 …/app/Http/Middleware/CheckCsrf.php(80): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

21 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckCsrf->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

22 …/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

23 …/app/Webtrees.php(275): Middleland\Dispatcher->dispatch(Object(Nyholm\Psr7\ServerRequest))

24 …/app/Http/Middleware/Router.php(163): Fisharebest\Webtrees\Webtrees::dispatch(Object(Nyholm\Psr7\ServerRequest), Array)

25 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\Router->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

26 …/app/Http/Middleware/BootModules.php(58): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

27 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BootModules->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

28 …/app/Http/Middleware/RegisterGedcomTags.php(54): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

29 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\RegisterGedcomTags->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

30 …/app/Http/Middleware/LoadRoutes.php(75): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

31 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\LoadRoutes->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

32 …/app/Http/Middleware/CheckForNewVersion.php(57): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

33 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckForNewVersion->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

34 …/app/Http/Middleware/UseTransaction.php(45): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

35 …/vendor/illuminate/database/Concerns/ManagesTransactions.php(29): Fisharebest\Webtrees\Http\Middleware\UseTransaction::Fisharebest\Webtrees\Http\Middleware{closure}(Object(Illuminate\Database\MySqlConnection))

36 …/app/Http/Middleware/UseTransaction.php(44): Illuminate\Database\Connection->transaction(Object(Closure), 3)

37 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseTransaction->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

38 …/app/Http/Middleware/DoHousekeeping.php(71): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

39 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\DoHousekeeping->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

40 …/app/Http/Middleware/UseTheme.php(67): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

41 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseTheme->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

42 …/app/Http/Middleware/CheckForMaintenanceMode.php(51): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

43 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckForMaintenanceMode->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

44 …/app/Http/Middleware/UseLanguage.php(69): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

45 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseLanguage->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

46 …/app/Http/Middleware/UseSession.php(78): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

47 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseSession->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

48 …/app/Http/Middleware/UpdateDatabaseSchema.php(57): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

49 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UpdateDatabaseSchema->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

50 …/app/Http/Middleware/UseDatabase.php(122): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

51 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseDatabase->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

52 …/app/Http/Middleware/BadBotBlocker.php(308): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

53 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BadBotBlocker->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

54 …/app/Http/Middleware/CompressResponse.php(71): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

55 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CompressResponse->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

56 …/app/Http/Middleware/ContentLength.php(40): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

57 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ContentLength->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

58 …/vendor/middlewares/client-ip/src/ClientIp.php(65): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

59 …/app/Http/Middleware/ClientIp.php(47): Middlewares\ClientIp->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

60 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ClientIp->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

61 …/app/Http/Middleware/HandleExceptions.php(89): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

62 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\HandleExceptions->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

63 …/app/Http/Middleware/BaseUrl.php(73): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

64 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BaseUrl->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

65 …/app/Http/Middleware/ReadConfigIni.php(68): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

66 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ReadConfigIni->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

67 …/app/Http/Middleware/SecurityHeaders.php(48): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

68 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\SecurityHeaders->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

69 …/app/Http/Middleware/EmitResponse.php(57): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

70 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\EmitResponse->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))

71 …/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))

72 …/app/Webtrees.php(275): Middleland\Dispatcher->dispatch(Object(Nyholm\Psr7\ServerRequest))

73 …/app/Webtrees.php(262): Fisharebest\Webtrees\Webtrees::dispatch(Object(Nyholm\Psr7\ServerRequest), Array)

74 …/index.php(51): Fisharebest\Webtrees\Webtrees->httpRequest()

75 {main}`

tcpdf version is 6.7.4. PHP-Version is 8.3.8 as can be seen in my phpinfo(): https://bin.disroot.org/?62640b6821ca1bb4#7gNY8rrS6xrJcfRsGhjroPFcDszMEsXviHwuGRcYv5G3

littlepackage commented 1 month ago

PHP 8.3.8 is pretty aggressive for TCPDF. Roll down the version <= 8.2 first and see if that helps.

joesse commented 1 month ago

Thank you for this advice. 8.2 is not available for me, so I went back to 8.1.29, but unfortunately, the error is the same.

littlepackage commented 1 month ago

On your installation, are you trying to use a different font? Where is your code? (Pls show it.) What version of TCPDF are you using?

joesse commented 1 month ago

TCPDF is used by webtrees, an online genealogy software. I can only try to answer your questions. I created a document on webtrees' demo site. It uses Helvetica and DejaVuSans. My PDF-Viewer says "all fonts are either standard or embedded". I did not change fonts in my installation, don't know if that's even possible. Code can be found here: https://github.com/fisharebest/webtrees/tree/main/app/Report Version is 6.7.4