Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP 8.0 Fatal error: tcpdf, barcodepack and PHPExcel use curly braces
01-28-2023, 10:19 AM, (This post was last modified: 01-28-2023, 10:20 AM by TurboPT.)
#11
RE: PHP Fatal error: Array and string offset access syntax with curly braces
Thanks Dale, I merged that commit.

Though I've not yet given a trial run, the commit looked fine to me. Third-party updates are typically straight drop-in updates.
Reply
01-29-2023, 06:04 AM,
#12
RE: PHP Fatal error: Array and string offset access syntax with curly braces
Thanks Paul, I'm sure the commit will be ok. I read the CHANGELOG.txt and it should be compatible back to PHP 5.

Fwiw, we will eventually need to migrate to tc-lib-pdf, possibly for PHP 8.1. tc-lib-pdf (https://github.com/tecnickcom/tc-lib-pdf) is the direct successor to tcpdf. The project reports it's a breaking change, but there is a migration script to help with the changes.

We will also have to eventually migrate PHPExcel to PHPSpreadsheet (direct successor), possibly for PHP 8.1 as well.

But back to the barcodepack and PHPExcel patches...
http://www.dalescott.net
Reply
01-29-2023, 01:26 PM, (This post was last modified: 01-31-2023, 02:20 AM by dalescott.)
#13
RE: PHP Fatal error: Array and string offset access syntax with curly braces
Hi Paul, I hope this makes sense to you.

I submitted a PR for the PHPExcel changes, closed it after realizing I submitted it to the after_4.15.1_bug_fixes_only branch instead of to the master branch, and then created a new PR for the master branch. Hopefully everything is ok, but just say if you need me to do anything.

Will you be able to test? I exported a CSV file using Z_DataExport.php, but reading through the script iiuc it doesn't use PHPExcel. I then grepped the code for PHPExcel and it looks like PHPExcel is used only by PcAnalysis.php and PcTabExpensesList.php. I tried executing PcAnalysis.php and didn't get any output (I think because of an error in the log file "2023-01-28 07-01-56,ERROR Report,dalescott,This form was not submitted with a correct ID"), but I'm not sure if I have petty cash setup either. fwiw there weren't any errors in the Apache log file.

Let me know if there's anything else I can do.
http://www.dalescott.net
Reply
01-31-2023, 02:16 AM, (This post was last modified: 01-31-2023, 03:00 AM by dalescott.)
#14
RE: PHP 8.0 Fatal error: Array and string offset access syntax with curly braces
I submitted a PR for the barcodepack changes, the code passes php 8.0 lint but I can't figure out how to generate some barcodes to test functionality.

I'm going to try doing a functional regression test now, starting with entering part numbers and supply chain, followed by a couple basic purchasing cycles and then a basic manufacturing cycle. I.e. work through the tutorials I wrote (https://www.dalescott.net/weberp-tutorials) and watch for behavioral issues, PHP execution errors, and log file curiousities.

Fwiw, I've encountered two issues, but don't know if they are PHP 8.0 issues per se, previously existing issues that now fail using PHP 8.0, previously existing issues that would have failed with PHP 7.4, or issues due to my company setup/config.

1. accessing Menu > Setup > General Setup > Currencies Maintenance results in a PHP div by zero error ([Sun Jan 29 22:03:37.910974 2023] [php:error] [pid 47666] [client 174.0.43.39:60806] PHP Fatal error:  Uncaught DivisionByZeroError: Division by zero in /usr/local/www/weberp/Currencies.php:359\nStack trace:\n#0 {main}\n  thrown in /usr/local/www/weberp/Currencies.php on line 359, referer: https://weberp.dalescott.net/index.php?A...ion=system). I thought I had setup my currencies correctly (when using PHP 7.4), but from the (partially) rendered page it appears one of the currencies is missing a conversion factor and the div by zero error appears to prevent the page from being fully rendered and there are no buttons to edit the currencies. Adding the missing rate directly in the db appears to have restored correct page function.

2. accessing Menu > Setup > General Setup > Form Designer, selecting Work Order Paperwork, Submit, Preview the Form Layout, results in a HTTP Error 500 (server unable to handle request) in the browser and PHP error "[Mon Jan 30 09:47:27.921534 2023] [php:error] [pid 55056] [client 162.223.103.50:5347] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/weberp/includes/tcpdf/tcpdf.php:15660\nStack trace:\n#0 /usr/local/www/weberp/PDFWOPrint.php(486): TCPDF->write2DBarcode()\n#1 {main}\n  thrown in /usr/local/www/weberp/includes/tcpdf/tcpdf.php on line 15660, referer: https://weberp.dalescott.net/FormDesigner.php"

I can investigate these issues further if you think it would be useful, or just keep track of them and include them in the results of the functional regression test in a new thread. Let me know what you think would be best.

Cheers,
Dale
http://www.dalescott.net
Reply
01-31-2023, 12:16 PM,
#15
RE: PHP 8.0 Fatal error: Array and string offset access syntax with curly braces
Thanks for all that info, Dale. I'll have a look as soon as I can. Typically, weekends tend to be the better opportunity for me, but I'll see if I can help take a look sooner.

Quote:after_4.15.1_bug_fixes_only branch

Yeah, because of GitHub's switch to 2FA a couple of years ago, I've not been able to log into the primary webERP to remove that branch and restore master as the default. Sad  The 2FA goes to an email account that I do not have access.
Reply
02-01-2023, 07:36 AM, (This post was last modified: 02-02-2023, 02:24 AM by dalescott.)
#16
RE: PHP 8.0 Fatal error: tcpdf, barcodepack and PHPExcel use curly braces
Paul, there may be an issue with my tcpdf PR, the webERP user manual reports that tcpdf was modified by the webERP project. 

From the manual TOC "Development Foundations" (ManualNewScripts.html), under "Directory Structure": http://www.weberp.org/weberp/ManualConte...NewScripts

Quote:Also, the TCPDF class which is a derivative of Olivier Plathey's FPDF class developed by Nicola Asuni that enables pdf files to be created by webERP using the utf-8 character set and CID fonts - this allows webERP to create lightweight pdf files where the fonts for all languages are bundled by adobe acrobat reader. Although this class is maintained as a separate project there have been some modifications to this class by Javier de Lorenzo-Cáceres that allow CID fonts to be mapped correctly.

I also found a reference to Javier's work in the original webERP (wiki) website, which gives a little more information: https://weberp.org/wiki/Utf8Pdf

I saw Javier had provided two new fonts (which I kept), but I hadn't realized the code had been modified. I'm not familar with use of CID fonts ("CID-keyed fonts"?) in webERP, and can't say what the effect of not merging Javier's changes into the upgraded tcpdf will be. I've generated a couple PDFs using the upgraded tcpdf, so the effect may range from none if using English, to larger PDF file sizes than before if using non-English and CID fonts, to potentially catastrophic failure in some cases (e.g. the Work Order Paperwork preview error I posted yesterday, _if_ tcpdf is actually the cause).

I'm not sure where to go from here. For now, perhaps my tcpdf commit should be reverted and my other two PRs either ignored or closed without accepting. When I get some time I'll diff the original tcpdf against tcpdf-6.2.2 to see how extensive the changes were.

I'm feeling supporting PHP 8+ will require more skill and experience than I have, but I'm not sure if PHP 8 is high on anyone elses priority list after searching the forum and mailing list archives. I found only one topic in the forum, from Tim Schofield in 2020 that you replied to: http://www.weberp.org/forum/showthread.php?tid=8416, and no mention in the mailing lists. However, Tim says in the forum post that he has had private conversations with other developers, so perhaps there is more happening than it appears.

I would downgrade my server to PHP 7.4, but I need PHP 8 for Nextcloud, SuiteCRM and Moodle (fwiw, WackoWiki recommends PHP 8.1). 

What are your thoughts?
http://www.dalescott.net
Reply
02-09-2023, 04:46 AM,
#17
RE: PHP 8.0 Fatal error: tcpdf, barcodepack and PHPExcel use curly braces
I compared the weberp version of tcpdf-5-9.161 vs tcpdf-6.2.2 but couldn't identify any changes made by Javier (also no comments with "javier" in them). If I can get the original source for tcpdf-5.9.161, I'll compare it to the files in webERP (I found the version number in a tcpdf file in webERP).
http://www.dalescott.net
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)