php fatal error when creating the first invoice
-
Dear creator,
there is a fatal php error when the site is creating the first invoice, this does not happen when the site already has order before. the following error is from apache error log:
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in ……/woocommerce-pdf-invoices/vendor/mpdf/mpdf/classes/ttfontsuni.php:613
at line 613:
the variable $psName is not an array when the shop has no order before (aka: has no invoice before)what I did to workaround the issue, I added a “checking if loop” in front of the the for loop to fix the issue:
//i added the following line if(!empty($psName) && is_array($psName)){ for ($i = 0; $i < count($psName); $i++) { $c = $psName[$i]; $oc = ord($c); if ($oc > 126 || strpos(' [](){}<>/%', $c) !== false) { //throw new MpdfException("psName=".$psName." contains invalid character ".$c." ie U+".ord(c)); $psNameInvalid = true; break; } } //i added the following line }
hope the issue can be fixed in the next version
Thank you!
- The topic ‘php fatal error when creating the first invoice’ is closed to new replies.