tomolimo / ticketcleaner

Home for Ticket Cleaner GLPI plugin
8 stars 2 forks source link

PHP Warning - Trying to access array offset on value of type null #34

Closed blippercop closed 6 months ago

blippercop commented 6 months ago

Getting this warning on GLPI 10.0.10 Ticketcleaner 4.0.2

PHP Notice: Trying to access array offset on value of type null in /var/www/uem/plugins/ticketcleaner/hook.php on line 63

Table looks like this (only one row): YAML 1.1 uem.glpi_plugin_ticketcleaner_picturehashes_lastupdate

id: 1 lastupdate: 20220626224221

tomolimo commented 6 months ago

Hello @blippercop Could you detail step by step? Could you give a minimalist sample in order to reproduce? Could you post the log files: php-errors.log, sql-errors.log, TicketCleaner.log (to get this one you must activated GLPI debug mode)? Thank you, Regards, Tomolimo

blippercop commented 6 months ago

I will try to add information, but I was not sure myself what was causing this.

Now I know this issues happens when an email is pulled that contains an inline picture.

This issue is not(!) logged in the php-error log etc. Loading of sha1 files from '/var/www/helpdesk/plugins/ticketcleaner/pictures' into DB done. 2024-02-07 09:16:01 [-server] Ticket: 'test' File: '/var/www/uem/files/_tmp/pastedgraphic-1.png' type: 'image/png' sha1: 'f702b3acf4a0f470961fa6080c5383e304f18697' deleted: 'False'

it is logged by the crontab and not the GLPI logs So all outputs of the crontab are logged on my system - this will show normally no output except for some php warnings

I will try to analyze further.

blippercop commented 6 months ago

$res = $DB->request('glpi_plugin_ticketcleaner_picturehashes_lastupdate'); if ($res->numrows() > 0) { //$row = $DB->fetch_array($res); $row = $res->next(); $lastupdate = $row['lastupdate']; }

after $res->next(); the $row is null. is $row = $res->current(); an option? It returns the correct value.

tomolimo commented 6 months ago

Hello @blippercop Thank you for your issue, this is fixed in 4.0.3 https://github.com/tomolimo/ticketcleaner/releases/tag/4.0.3 Regards, Tomolimo

blippercop commented 6 months ago

Thank you for the fast fix!