Issue with location of mpdf.php with 1.4.9?

I have upgraded a site to 1.4.9 and when I try to access a PDF of an invoice I get a 500 error, with the site set to development mode this message is displayed:

Severity: Warning
Message: require_once(/home/ip/sites/default/vendor/mpdf/mpdf/mpdf.php): failed to open stream: No such file or directory
Filename: helpers/mpdf_helper.php
Line Number: 30

Line 30 of application/helpers/mpdf_helper.php contains:

    require_once(FCPATH . 'vendor/mpdf/mpdf/mpdf.php');

Looking for mpdf.php:

 find ./ -name mpdf.php
./application/helpers/mpdf/mpdf.php

There is no vendor directory anywhere?

Have I done something wrong?

I fixed this by installing the latest mpdf, 6.1.0 by running this command in the DocumentRoot:

composer require mpdf/mpdf 6.1.0

But I’m now getting another issue on the HTML invoice page that clients see:

A PHP Error was encountered

Severity: Notice
Message: Undefined property: stdClass::$invoice_item_total
Filename: public/InvoicePlane_Web.php
Line Number: 185

However this only shows up when ENVIRONMENT is set to development in index.php.

No, sorry. But running composer require mpdf/mpdf 6.1.0 is completely wrong. There already is a composer.json with all requirements you need. Please delete the vendor directory and simply run composer install.

Thank you, have done, the vendor directory was recreated when composer install was run, is this to be expected (sorry haven’t really used composer for installing software libraries before).

Yes it’s correct.

The Undefined property: stdClass::$invoice_item_total error seems to be a missing or wrong variable inside the public/InvoicePlane_Web.php template. Does the view still works?

I only get the error if inxed.php is edited to put the site into development mode:

/*
 * if (is_dir(__DIR__ . "/application/config/development")) {
 *     define('ENVIRONMENT', 'development');
 * } else {
 *     define('ENVIRONMENT', 'production');
 * }
*/
define('ENVIRONMENT', 'development');

You can see the error here:

Line 185 of application/views/invoice_templates/public/InvoicePlane_Web.php in context:

182                         <tr>
183                             <td colspan="4"></td>
184                             <td class="text-right"><?php echo trans('subtotal'); ?>:</td>
185                             <td class="amount"><?php echo format_currency($invoice->invoice_item_total); ?></td>
186                         </tr>