Error sales_by_client

Hi,
I get the following error code after updating my PHP version to PHP7.2.
It has something to do with the way PHP 7.2 handles the errors. see this link
Something in the following code causes this error.

<?php echo $result->invoice_count; $report_inv_count = $result->invoice_count + $report_inv_count; ?>

Any ideas? THX Freek

A PHP Error was encountered

Severity: Warning Message: A non-numeric value encountered Filename: reports/sales_by_client.php Line Number: 33 Backtrace: File: /home/wesaca/facturatie.wesaca.com/application/views/reports/sales_by_client.php Line: 33 Function: _error_handler File: /home/wesaca/facturatie.wesaca.com/application/third_party/MX/Loader.php Line: 464 Function: include File: /home/wesaca/facturatie.wesaca.com/application/third_party/MX/Loader.php Line: 415 Function: _ci_load File: /home/wesaca/facturatie.wesaca.com/application/modules/reports/controllers/Reports.php Line: 37 Function: view File: /home/wesaca/facturatie.wesaca.com/index.php Line: 325 Function: require_once

Not sure, but here’s the entire topic regarding php 7.2 and 7.3 PHP 7.2 upgrade long story short: install 1.5.10.1 or the master version.
Short story long: for php 7.2 and 1.5.9 apply some code changes

Unfortunately this change does not solve my problem.
THX anyway. Freek

This might probably not fix your problem, but try changing your code to

<?php echo $result-&gt;invoice_count; $report_inv_count = $result-&gt;invoice_count + (int) $report_inv_count; ?>

The code segment “(int) $report_inv_count” forces the value to a number.

If that works, it points to an unexpected value in the variable.
You can dump the value of the variable.

<? var_dump($report_inv_count); ?>

1 Like

Oh that’s right! Thanks crafter! The &gt; is an > of course, so that will make -> in the code

I changed the code crafter suggested and it works fine now. THX again for the awesome support!!
THX Freek

1 Like