Open eduardomozart opened 1 year ago
I was able to identify that the end_date column value changed from 2050-01-01 00:00:00 to 0000-00-00 00:00:00. After changing the 2050-01-01 00:00:00 end_date user value to NULL I was able to login as expected.
This is a MySQL issue, not a GLPI bug. MySQL TIMESTAMP data type is 32 bit only and therefore cannot support dates past 2038-01-19. Since it cannot support dates in the year 2050, it seems to have set the fields to 0000-00-00.
Strange that the date was already set to 2050-01-01 00:00:00
, it was seem possible on older GLPI versions so I believe it should be handled by TIMEZONE migration. Maybe when identifying dates > 2038-01-19 it could set the column value to NULL or it's limit (2038-01-19) instead.
It's related to timestampè column format.
dateand
datetimeformats are kind of
text` fields, therefore issue was not present.
Default value set when date is overriden is set by mysql... I do not know at the moment if we can fix your issue.
Maybe handling the SQL exception it would not be possible to set it's value to NULL
or 2038-01-19 00:00:00
instead?
Maybe handling the SQL exception it would not be possible to set it's value to
NULL
or2038-01-19 00:00:00
instead?
I think setting the value to the max limit (2038-01-19) could indeed be a solution. We should add some warnings in console output so the administrator will know that we had to alter some data.
I was able to identify that the end_date column value changed from 2050-01-01 00:00:00 to 0000-00-00 00:00:00. After changing the 2050-01-01 00:00:00 end_date user value to NULL I was able to login as expected.
This is a MySQL issue, not a GLPI bug. MySQL TIMESTAMP data type is 32 bit only and therefore cannot support dates past 2038-01-19. Since it cannot support dates in the year 2050, it seems to have set the fields to 0000-00-00.
Af of a reminder for futur us, when GLPI drops support of mysql prior 8.0.28, we may be able to migrate from TIMESTAMP
to DATETIME
as it is recommended to handle this behavior.
For mariaDB, we may have to do some tweeks with feature flags.
Sources :
Problem with migrating to DATETIME is missing timezone support; so we have to handle all that PHP side... And that's a huge work.
Problem with migrating to DATETIME is missing timezone support; so we have to handle all that PHP side... And that's a huge work.
I agree with you : it's a huge rework that needs to be brainstormed beforehand.
For timezone, DATETIME uses the server config (SYSTEM or specified in conf / session) such as we would have to document how to configure the server and app accordingly and rewrite the whole app with recorded DATETIME
and handle time in PHP with forced tz.
Migration "may" be do-able due to internal mysql functions but new datas have to be handled with cautious as the underlying mechanisms may be more complex in GLPI than in my head or a "fresh start".
Code of Conduct
Is there an existing issue for this?
Version
10.0.7
Bug description
After migrating from GLPI 9.5.2 to GLPI 10.0.7 to a MySQL server without timezone table access, I was able to login the first time but unable to login after
glpi:migration:timestamps
migration.Before migration, the user has the following entry on
glpi_users
table (the password hash was changed to 'glpi' password to avoid data leak):After migration:
After issue the
glpi:migration:timestamps
command:Following the troubleshoots steps available at https://forum.glpi-project.org/viewtopic.php?pid=491839 I was able to identify that the
end_date
column value changed from2050-01-01 00:00:00
to0000-00-00 00:00:00
. After changing the2050-01-01 00:00:00
end_date user value toNULL
I was able to login as expected.Maybe it's changing the value the
end_date
column value of the user to0000-00-00 00:00:00
because our host doesn't support MySQL timezones? Most hosting services based on CPanel do not offer access to themysql.time_zone_name
table and GLPI installer allows to continue the GLPI installation/migration just fine. If it's required, this installation check should be changed to enforce it. If it isn't a requirement, maybe there's a bug on TIMEZONE migration or GLPIend_date
verification logic should be changed to handle the0000-00-00 00:00:00
value with the same treatment that theNULL
value has.Relevant log output
sql-errors.log:
Page URL
https://helpdesk.example.com/index.php?noAUTO=1
Steps To reproduce
Your GLPI setup information
Instruções de instalação e configuração
Server
GLPI constants
Libraries
SQL replicas
Notifications
Plugins list
Anything else?
No response