glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.36k stars 1.3k forks source link

Some local users are unable to log-in after GLPI TIMEZONE migration #14842

Open eduardomozart opened 1 year ago

eduardomozart commented 1 year ago

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):

INSERT INTO `glpi_users` VALUES (25,'mgomes','$2y$10$p..X4No3kbL9zq3s9yyXuuNdbHN78Bd/j8aiInj5L7Fo1Hg3hJMFa',NULL,'8134267006','','','Gomes','Marcio',0,NULL,0,NULL,1,'',0,1,'2023-04-13 15:37:34','2022-07-27 14:58:21',NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'',NULL,NULL,NULL,'3Wq4KeCZpVy5Wfy665FEsFYisnk0I7kDSm9gxAxH','2021-01-21 20:27:42',NULL,NULL,'$2y$10$xM4OzojsFwZqXPbpJCh6a.RDrRhQa/.TaC3e.kE24i5o1rUpIuJbu','2022-07-27 14:58:21',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,'2019-12-01 00:00:00','2050-01-01 00:00:00',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2020-02-27 15:58:43',NULL,'{\"filters\":{\"ChangeTask\":{\"color\":\"#E94A31\",\"display\":true,\"type\":\"event_filter\"},\"ProblemTask\":{\"color\":\"#5174F2\",\"display\":true,\"type\":\"event_filter\"},\"Reminder\":{\"color\":\"#51C9F2\",\"display\":true,\"type\":\"event_filter\"},\"TicketTask\":{\"color\":\"#FFCC29\",\"display\":true,\"type\":\"event_filter\"},\"ProjectTask\":{\"color\":\"#20C646\",\"display\":true,\"type\":\"event_filter\"},\"PlanningExternalEvent\":{\"color\":\"#364959\",\"display\":true,\"type\":\"event_filter\"},\"NotPlanned\":{\"color\":\"#8C5344\",\"display\":false,\"type\":\"event_filter\"},\"OnlyBgEvents\":{\"color\":\"#FF8100\",\"display\":false,\"type\":\"event_filter\"}},\"plannings\":{\"user_25\":{\"color\":\"#FFEEC4\",\"display\":true,\"type\":\"user\"}},\"lastview\":\"timeGridWeek\"}',NULL,0,0,NULL,NULL,NULL,NULL,NULL);

After migration:

INSERT INTO `glpi_users` VALUES (25, 'mgomes', '$2y$10$p..X4No3kbL9zq3s9yyXuuNdbHN78Bd/j8aiInj5L7Fo1Hg3hJMFa', NULL, '8134267006', '', '', 'Gomes', 'Marcio', 0, NULL, 0, NULL, 1, '', 0, 1, '2023-05-31 17:26:46', '2022-07-27 14:58:21', NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, NULL, '3Wq4KeCZpVy5Wfy665FEsFYisnk0I7kDSm9gxAxH', '2021-01-21 20:27:42', NULL, NULL, '$2y$10$xM4OzojsFwZqXPbpJCh6a.RDrRhQa/.TaC3e.kE24i5o1rUpIuJbu', '2022-07-27 14:58:21', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, '2019-12-01 00:00:00', '2050-01-01 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2020-02-27 15:58:43', NULL, '{\"filters\":{\"ChangeTask\":{\"color\":\"#E94A31\",\"display\":true,\"type\":\"event_filter\"},\"ProblemTask\":{\"color\":\"#5174F2\",\"display\":true,\"type\":\"event_filter\"},\"Reminder\":{\"color\":\"#51C9F2\",\"display\":true,\"type\":\"event_filter\"},\"TicketTask\":{\"color\":\"#FFCC29\",\"display\":true,\"type\":\"event_filter\"},\"ProjectTask\":{\"color\":\"#20C646\",\"display\":true,\"type\":\"event_filter\"},\"PlanningExternalEvent\":{\"color\":\"#364959\",\"display\":true,\"type\":\"event_filter\"},\"NotPlanned\":{\"color\":\"#8C5344\",\"display\":false,\"type\":\"event_filter\"},\"OnlyBgEvents\":{\"color\":\"#FF8100\",\"display\":false,\"type\":\"event_filter\"}},\"plannings\":{\"user_25\":{\"color\":\"#FFEEC4\",\"display\":true,\"type\":\"user\"}},\"lastview\":\"timeGridWeek\"}', NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0);

After issue the glpi:migration:timestamps command:

INSERT INTO `glpi_users` VALUES (25, 'mgomes', '$2y$10$p..X4No3kbL9zq3s9yyXuuNdbHN78Bd/j8aiInj5L7Fo1Hg3hJMFa', NULL, '8134267006', '', '', 'Gomes', 'Marcio', 0, NULL, 0, NULL, 1, '', 0, 1, '2023-05-31 17:26:46', '2022-07-27 14:58:21', NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, NULL, '3Wq4KeCZpVy5Wfy665FEsFYisnk0I7kDSm9gxAxH', '2021-01-21 20:27:42', NULL, NULL, '$2y$10$xM4OzojsFwZqXPbpJCh6a.RDrRhQa/.TaC3e.kE24i5o1rUpIuJbu', '2022-07-27 14:58:21', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, '2019-12-01 00:00:00', '0000-00-00 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2020-02-27 15:58:43', NULL, '{\"filters\":{\"ChangeTask\":{\"color\":\"#E94A31\",\"display\":true,\"type\":\"event_filter\"},\"ProblemTask\":{\"color\":\"#5174F2\",\"display\":true,\"type\":\"event_filter\"},\"Reminder\":{\"color\":\"#51C9F2\",\"display\":true,\"type\":\"event_filter\"},\"TicketTask\":{\"color\":\"#FFCC29\",\"display\":true,\"type\":\"event_filter\"},\"ProjectTask\":{\"color\":\"#20C646\",\"display\":true,\"type\":\"event_filter\"},\"PlanningExternalEvent\":{\"color\":\"#364959\",\"display\":true,\"type\":\"event_filter\"},\"NotPlanned\":{\"color\":\"#8C5344\",\"display\":false,\"type\":\"event_filter\"},\"OnlyBgEvents\":{\"color\":\"#FF8100\",\"display\":false,\"type\":\"event_filter\"}},\"plannings\":{\"user_25\":{\"color\":\"#FFEEC4\",\"display\":true,\"type\":\"user\"}},\"lastview\":\"timeGridWeek\"}', NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0);

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 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.

Maybe it's changing the value the end_date column value of the user to 0000-00-00 00:00:00 because our host doesn't support MySQL timezones? Most hosting services based on CPanel do not offer access to the mysql.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 GLPI end_date verification logic should be changed to handle the 0000-00-00 00:00:00 value with the same treatment that the NULL value has.

Relevant log output

sql-errors.log:

[2023-05-31 17:45:03] glpisqllog.WARNING: DBmysql::query() in /home/opoderdasvendasc/helpdesk/glpi/src/DBmysql.php line 404
  *** MySQL query warnings:
  SQL: ALTER TABLE `glpi_users` 
     MODIFY COLUMN `last_login` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `date_mod` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `date_sync` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `password_forget_token_date` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `personal_token_date` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `api_token_date` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `cookie_token_date` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `begin_date` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `end_date` TIMESTAMP NULL DEFAULT NULL,
     MODIFY COLUMN `date_creation` TIMESTAMP NULL DEFAULT NULL;

  Warnings: 
1264: Out of range value for column 'end_date' at row 2
1264: Out of range value for column 'end_date' at row 13
1264: Out of range value for column 'end_date' at row 14
  Backtrace :
  src/Console/Migration/TimestampsCommand.php:185    
  vendor/symfony/console/Command/Command.php:298     Glpi\Console\Migration\TimestampsCommand->execute()
  vendor/symfony/console/Application.php:1040        Symfony\Component\Console\Command\Command->run()
  src/Console/Application.php:272                    Symfony\Component\Console\Application->doRunCommand()
  vendor/symfony/console/Application.php:301         Glpi\Console\Application->doRunCommand()
  vendor/symfony/console/Application.php:171         Symfony\Component\Console\Application->doRun()
  bin/console:122                                    Symfony\Component\Console\Application->run()
  {"user":"@scca1.icloudzinc.com"} 

Page URL

https://helpdesk.example.com/index.php?noAUTO=1

Steps To reproduce

  1. Migrate from GLPI 9.5.2 to GLPI 10.
  2. Login at GLPI (it works as expected).
  3. Do the TIMEZONE migration.
  4. Some local users are unable to login.

Your GLPI setup information

Instruções de instalação e configuração
GLPI 10.0.7 ( => /home/opoderdasvendasc/helpdesk/glpi)
Installation mode: TARBALL
Current language:pt_BR

Server
 
Operating system: Linux scca1.icloudzinc.com 4.18.0-425.3.1.lve.el8.x86_64 #1 SMP Tue Nov 22 22:59:23 EST 2022 x86_64
PHP 7.4.33 litespeed (Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, bcmath, bz2, calendar, ctype, curl, date, dba, dom,
    enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, i360, iconv, imap, intl, json, ldap, libxml, litespeed, mbstring,
    mysqli, mysqlnd, odbc, openssl, pcntl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, pspell, readline, session, shmop,
    soap, sockets, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, timezonedb, tokenizer, xml, xmlreader, xmlrpc, xmlwriter,
    xsl, zip, zlib)
Setup: max_execution_time="3000" memory_limit="128M" post_max_size="128M" safe_mode="" session.save_handler="files"
    upload_max_filesize="128M" 
Software: LiteSpeed
    Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Server Software: MariaDB Server
    Server Version: 10.3.38-MariaDB-cll-lve
    Server SQL Mode: NO_ENGINE_SUBSTITUTION
    Parameters: opoderdasvendasc_glpi@localhost/opoderdasvendasc_glpi
    Host info: Localhost via UNIX socket

PHP version (7.4.33) is supported.
Sessions configuration is OK.
Allocated memory is sufficient.
mysqli extension is installed.
Following extensions are installed: dom, fileinfo, json, simplexml.
curl extension is installed.
gd extension is installed.
intl extension is installed.
libxml extension is installed.
zlib extension is installed.
The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present.
Database engine version (10.3.38) is supported.
No files from previous GLPI version detected.
The log file has been created successfully.
Write access to /home/opoderdasvendasc/helpdesk/files/_cache has been validated.
Write access to /home/opoderdasvendasc/helpdesk/config/ has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_cron has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_dumps has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_graphs has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_lock has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_pictures has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_plugins has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_rss has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_sessions has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_tmp has been validated.
Write access to /home/opoderdasvendasc/helpdesk/files/_uploads has been validated.
PHP 7.4 official support has ended. An upgrade to a more recent PHP version is recommended.
Web server root directory configuration is not safe as it permits access to non-public files. See installation documentation for more details.
GLPI data directories are located in a secured path.
PHP directive "session.cookie_secure" should be set to "on" when GLPI can be accessed on HTTPS protocol.
PHP directive "session.cookie_httponly" should be set to "on" to prevent client-side script to access cookie values.
OS and PHP are relying on 64 bits integers.
exif extension is installed.
ldap extension is installed.
openssl extension is installed.
Following extensions are installed: bz2, Phar, zip.
Zend OPcache extension is not present.
Following extensions are installed: ctype, iconv, mbstring.
Following extensions are not present: sodium.
Write access to /home/opoderdasvendasc/helpdesk/glpi/marketplace has been validated.
Access to timezone database (mysql) is not allowed.

GLPI constants
 
GLPI_ROOT: "/home/opoderdasvendasc/helpdesk/glpi"
GLPI_CONFIG_DIR: "/home/opoderdasvendasc/helpdesk/config/"
GLPI_VAR_DIR: "/home/opoderdasvendasc/helpdesk/files"
GLPI_LOG_DIR: "/home/opoderdasvendasc/helpdesk/files/_log"
GLPI_MARKETPLACE_DIR: "/home/opoderdasvendasc/helpdesk/glpi/marketplace"
GLPI_USE_CSRF_CHECK: "1"
GLPI_CSRF_EXPIRES: "7200"
GLPI_CSRF_MAX_TOKENS: "100"
GLPI_USE_IDOR_CHECK: "1"
GLPI_IDOR_EXPIRES: "7200"
GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["/^(https?|feed):\\/\\/[^@:]+(\\/.*)?$/"]
GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org"
GLPI_INSTALL_MODE: "TARBALL"
GLPI_NETWORK_MAIL: "glpi@teclib.com"
GLPI_NETWORK_SERVICES: "https://services.glpi-network.com"
GLPI_MARKETPLACE_ALLOW_OVERRIDE: true
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true
GLPI_USER_AGENT_EXTRA_COMMENTS: ""
GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1"
GLPI_AJAX_DASHBOARD: "1"
GLPI_CALDAV_IMPORT_STATE: 0
GLPI_DEMO_MODE: "0"
GLPI_CENTRAL_WARNINGS: "1"
GLPI_DOC_DIR: "/home/opoderdasvendasc/helpdesk/files"
GLPI_CACHE_DIR: "/home/opoderdasvendasc/helpdesk/files/_cache"
GLPI_CRON_DIR: "/home/opoderdasvendasc/helpdesk/files/_cron"
GLPI_DUMP_DIR: "/home/opoderdasvendasc/helpdesk/files/_dumps"
GLPI_GRAPH_DIR: "/home/opoderdasvendasc/helpdesk/files/_graphs"
GLPI_LOCAL_I18N_DIR: "/home/opoderdasvendasc/helpdesk/files/_locales"
GLPI_LOCK_DIR: "/home/opoderdasvendasc/helpdesk/files/_lock"
GLPI_PICTURE_DIR: "/home/opoderdasvendasc/helpdesk/files/_pictures"
GLPI_PLUGIN_DOC_DIR: "/home/opoderdasvendasc/helpdesk/files/_plugins"
GLPI_RSS_DIR: "/home/opoderdasvendasc/helpdesk/files/_rss"
GLPI_SESSION_DIR: "/home/opoderdasvendasc/helpdesk/files/_sessions"
GLPI_TMP_DIR: "/home/opoderdasvendasc/helpdesk/files/_tmp"
GLPI_UPLOAD_DIR: "/home/opoderdasvendasc/helpdesk/files/_uploads"
GLPI_INVENTORY_DIR: "/home/opoderdasvendasc/helpdesk/files/_inventories"
GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/"
GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/glpi-plugins/"
GLPI_I18N_DIR: "/home/opoderdasvendasc/helpdesk/glpi/locales"
GLPI_VERSION: "10.0.7"
GLPI_SCHEMA_VERSION: "10.0.7@5d45269702917a32805e25b678f6779a98b145f6"
GLPI_MARKETPLACE_PRERELEASES: false
GLPI_MIN_PHP: "7.4.0"
GLPI_MAX_PHP: "8.3.0"
GLPI_YEAR: "2023"

Libraries
 
htmlawed/htmlawed version 1.2.9 in (/home/opoderdasvendasc/helpdesk/glpi/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.8.0 in (/home/opoderdasvendasc/helpdesk/glpi/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.8 in (/home/opoderdasvendasc/helpdesk/glpi/vendor/simplepie/simplepie/library)
tecnickcom/tcpdf version 6.6.2 in (/home/opoderdasvendasc/helpdesk/glpi/vendor/tecnickcom/tcpdf)
michelf/php-markdown in (/home/opoderdasvendasc/helpdesk/glpi/vendor/michelf/php-markdown/Michelf)
true/punycode in (/home/opoderdasvendasc/helpdesk/glpi/vendor/true/punycode/src)
iamcal/lib_autolink in (/home/opoderdasvendasc/helpdesk/glpi/vendor/iamcal/lib_autolink)
sabre/dav in (/home/opoderdasvendasc/helpdesk/glpi/vendor/sabre/dav/lib/DAV)
sabre/http in (/home/opoderdasvendasc/helpdesk/glpi/vendor/sabre/http/lib)
sabre/uri in (/home/opoderdasvendasc/helpdesk/glpi/vendor/sabre/uri/lib)
sabre/vobject in (/home/opoderdasvendasc/helpdesk/glpi/vendor/sabre/vobject/lib)
laminas/laminas-i18n in (/home/opoderdasvendasc/helpdesk/glpi/vendor/laminas/laminas-i18n/src)
laminas/laminas-servicemanager in (/home/opoderdasvendasc/helpdesk/glpi/vendor/laminas/laminas-servicemanager/src)
monolog/monolog in (/home/opoderdasvendasc/helpdesk/glpi/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/home/opoderdasvendasc/helpdesk/glpi/vendor/sebastian/diff/src)
donatj/phpuseragentparser in (/home/opoderdasvendasc/helpdesk/glpi/vendor/donatj/phpuseragentparser/src/UserAgent)
elvanto/litemoji in (/home/opoderdasvendasc/helpdesk/glpi/vendor/elvanto/litemoji/src)
symfony/console in (/home/opoderdasvendasc/helpdesk/glpi/vendor/symfony/console)
scssphp/scssphp in (/home/opoderdasvendasc/helpdesk/glpi/vendor/scssphp/scssphp/src)
laminas/laminas-mail in (/home/opoderdasvendasc/helpdesk/glpi/vendor/laminas/laminas-mail/src/Protocol)
laminas/laminas-mime in (/home/opoderdasvendasc/helpdesk/glpi/vendor/laminas/laminas-mime/src)
rlanvin/php-rrule in (/home/opoderdasvendasc/helpdesk/glpi/vendor/rlanvin/php-rrule/src)
blueimp/jquery-file-upload in (/home/opoderdasvendasc/helpdesk/glpi/vendor/blueimp/jquery-file-upload/server/php)
ramsey/uuid in (/home/opoderdasvendasc/helpdesk/glpi/vendor/ramsey/uuid/src)
psr/log in (/home/opoderdasvendasc/helpdesk/glpi/vendor/psr/log/Psr/Log)
psr/simple-cache in (/home/opoderdasvendasc/helpdesk/glpi/vendor/psr/simple-cache/src)
psr/cache in (/home/opoderdasvendasc/helpdesk/glpi/vendor/psr/cache/src)
league/csv in (/home/opoderdasvendasc/helpdesk/glpi/vendor/league/csv/src)
mexitek/phpcolors in (/home/opoderdasvendasc/helpdesk/glpi/vendor/mexitek/phpcolors/src/Mexitek/PHPColors)
guzzlehttp/guzzle in (/home/opoderdasvendasc/helpdesk/glpi/vendor/guzzlehttp/guzzle/src)
guzzlehttp/psr7 in (/home/opoderdasvendasc/helpdesk/glpi/vendor/guzzlehttp/psr7/src)
glpi-project/inventory_format in (/home/opoderdasvendasc/helpdesk/glpi/vendor/glpi-project/inventory_format/lib/php)
wapmorgan/unified-archive in (/home/opoderdasvendasc/helpdesk/glpi/vendor/wapmorgan/unified-archive/src)
paragonie/sodium_compat in (/home/opoderdasvendasc/helpdesk/glpi/vendor/paragonie/sodium_compat/src)
symfony/cache in (/home/opoderdasvendasc/helpdesk/glpi/vendor/symfony/cache)
html2text/html2text in (/home/opoderdasvendasc/helpdesk/glpi/vendor/html2text/html2text/src)
symfony/css-selector in (/home/opoderdasvendasc/helpdesk/glpi/vendor/symfony/css-selector)
symfony/dom-crawler in (/home/opoderdasvendasc/helpdesk/glpi/vendor/symfony/dom-crawler)
twig/twig in (/home/opoderdasvendasc/helpdesk/glpi/vendor/twig/twig/src)
twig/string-extra in (/home/opoderdasvendasc/helpdesk/glpi/vendor/twig/string-extra)
symfony/polyfill-ctype not found
symfony/polyfill-iconv not found
symfony/polyfill-mbstring not found
symfony/polyfill-php80 in (/home/opoderdasvendasc/helpdesk/glpi/vendor/symfony/polyfill-php80)
symfony/polyfill-php81 in (/home/opoderdasvendasc/helpdesk/glpi/vendor/symfony/polyfill-php81)
symfony/polyfill-php82 in (/home/opoderdasvendasc/helpdesk/glpi/vendor/symfony/polyfill-php82)
league/oauth2-client in (/home/opoderdasvendasc/helpdesk/glpi/vendor/league/oauth2-client/src/Provider)
league/oauth2-google in (/home/opoderdasvendasc/helpdesk/glpi/vendor/league/oauth2-google/src/Provider)
thenetworg/oauth2-azure in (/home/opoderdasvendasc/helpdesk/glpi/vendor/thenetworg/oauth2-azure/src/Provider)

SQL replicas
 
Not active

Notifications
 
Way of sending emails: SMTP+TLS (helpdesk@example.com@142.250.0.109)

Plugins list
 
    reports              Name: Relatórios                     Version: 1.16.0     State: Enabled                                 
        Install Method: Manual
    tasklists            Name: Tasks list                     Version: 2.0.3      State: Enabled                                 
        Install Method: Manual

Anything else?

No response

cconard96 commented 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.

eduardomozart commented 1 year ago

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.

trasher commented 1 year ago

It's related to timestampè column format.dateanddatetimeformats are kind oftext` 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.

eduardomozart commented 1 year ago

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?

cedric-anne commented 1 year ago

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?

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.

keguira commented 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.

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 :

trasher commented 1 year ago

Problem with migrating to DATETIME is missing timezone support; so we have to handle all that PHP side... And that's a huge work.

keguira commented 1 year ago

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".