Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
blippercop opened this issue Feb 6, 2024 · 5 comments
Closed
Assignees
Labels

Comments

@blippercop
Copy link

blippercop commented Feb 6, 2024

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
Copy link
Owner

tomolimo commented Feb 7, 2024

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

@tomolimo tomolimo self-assigned this Feb 7, 2024
@tomolimo tomolimo added the bug label Feb 7, 2024
@blippercop
Copy link
Author

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
Copy link
Author

$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
Copy link
Owner

tomolimo commented Feb 7, 2024

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
Copy link
Author

Thank you for the fast fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants