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.3k stars 1.29k forks source link

Date '2038-01-18 22:14' is being inserted automatically in different parts of GLPI. #8250

Closed jcervantes-sipecom closed 3 years ago

jcervantes-sipecom commented 4 years ago

Describe the bug Hi, I don't know if this is an error in GLPI so I would ask for your help to solve it. The date '2038-01-18 22:14' is being inserted automatically in different parts of GLPI: in tickets when it's created by email receiver, tickettasks, begin date and end date in users when they are synced or imported with LDAP, etc.

I tried to look for some configuration in GLPI that is causing this behavior but I cannot find, I deactivated plugins and neither, in '/etc/php/7.4/apache2/php.ini' and '/etc/php/7.4/cli/php.ini 'I set date.timezone to my local timezone, restarted apache2 and the server but it keeps inserting that date.

Page(s) URL

To reproduce Steps to reproduce the behavior:

Expected behavior

Logs

Screenshots

-Users image

Your GLPI setup (you can find it in Setup > General menu, System tab)

[code]   
GLPI 9.5.2 (/g952 => /var/www/html/g952) Installation mode: TARBALL
--

Operating system: Linux sg01ilinv3sipe 4.15.0-122-generic #124-Ubuntu SMP Thu Oct 15 13:03:05 UTC 2020 x86_64 PHP 7.4.11 apache2handler (Core, FFI, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apc, apcu,   bz2, calendar, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imagick, imap, intl, json, ldap,  libxml, mbstring, memcache, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, pdo_sqlsrv, posix, pspell, readline, session,  shmop, snmp, soap, sockets, sodium, sqlsrv, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlrpc,   xmlwriter, xsl, zip, zlib) Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files"  upload_max_filesize="2M"  Software: Apache/2.4.29 (Ubuntu) (Apache/2.4.29 (Ubuntu) Server at 10.1.3.75 Port 80)     Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36 Edg/86.0.622.63 Server Software: mariadb.org binary distribution    Server Version: 10.4.15-MariaDB-1:10.4.15+maria~bionic-log  Server SQL Mode:    Parameters: glpi@localhost/g9495    Host info: Localhost via UNIX socket     PHP version is at least 7.2.0 - Perfect! Sessions support is available - Perfect! Allocated memory > 64 Mio - Perfect! mysqli extension is installed ctype extension is installed fileinfo extension is installed json extension is installed mbstring extension is installed iconv extension is installed zlib extension is installed curl extension is installed gd extension is installed simplexml extension is installed intl extension is installed ldap extension is installed apcu extension is installed Zend OPcache extension is installed xmlrpc extension is installed CAS extension is installed exif extension is installed zip extension is installed bz2 extension is installed sodium extension is installed Database version seems correct (10.4.15) - Perfect! Timezones seems loaded in database The log file has been created successfully. Write access to /var/www/html/g952/config has been validated. Write access to /var/www/html/g952/files has been validated. Write access to /var/www/html/g952/files/_dumps has been validated. Write access to /var/www/html/g952/files/_sessions has been validated. Write access to /var/www/html/g952/files/_cron has been validated. Write access to /var/www/html/g952/files/_graphs has been validated. Write access to /var/www/html/g952/files/_lock has been validated. Write access to /var/www/html/g952/files/_plugins has been validated. Write access to /var/www/html/g952/files/_tmp has been validated. Write access to /var/www/html/g952/files/_cache has been validated. Write access to /var/www/html/g952/files/_rss has been validated. Write access to /var/www/html/g952/files/_uploads has been validated. Write access to /var/www/html/g952/files/_pictures has been validated. Write access to /var/www/html/g952/marketplace has been validated. Web access to files directory is protected

GLPI_ROOT: /var/www/html/g952 GLPI_CONFIG_DIR: /var/www/html/g952/config GLPI_VAR_DIR: /var/www/html/g952/files GLPI_MARKETPLACE_DIR: /var/www/html/g952/marketplace GLPI_USE_CSRF_CHECK: 1 GLPI_CSRF_EXPIRES: 7200 GLPI_CSRF_MAX_TOKENS: 100 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_PRERELEASES:  GLPI_USER_AGENT_EXTRA_COMMENTS:  GLPI_AJAX_DASHBOARD: 1 GLPI_CALDAV_IMPORT_STATE: 0 GLPI_DEMO_MODE: 0 GLPI_FORCE_EMPTY_SQL_MODE: 1 GLPI_DOC_DIR: /var/www/html/g952/files GLPI_CACHE_DIR: /var/www/html/g952/files/_cache GLPI_CRON_DIR: /var/www/html/g952/files/_cron GLPI_DUMP_DIR: /var/www/html/g952/files/_dumps GLPI_GRAPH_DIR: /var/www/html/g952/files/_graphs GLPI_LOCAL_I18N_DIR: /var/www/html/g952/files/_locales GLPI_LOCK_DIR: /var/www/html/g952/files/_lock GLPI_LOG_DIR: /var/www/html/g952/files/_log GLPI_PICTURE_DIR: /var/www/html/g952/files/_pictures GLPI_PLUGIN_DOC_DIR: /var/www/html/g952/files/_plugins GLPI_RSS_DIR: /var/www/html/g952/files/_rss GLPI_SESSION_DIR: /var/www/html/g952/files/_sessions GLPI_TMP_DIR: /var/www/html/g952/files/_tmp GLPI_UPLOAD_DIR: /var/www/html/g952/files/_uploads 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: /var/www/html/g952/locales GLPI_VERSION: 9.5.2 GLPI_SCHEMA_VERSION: 9.5.2 GLPI_MIN_PHP: 7.2.0 GLPI_YEAR: 2020

htmlawed/htmlawed version 1.2.5 in (/var/www/html/g952/vendor/htmlawed/htmlawed) phpmailer/phpmailer version 6.1.6 in (/var/www/html/g952/vendor/phpmailer/phpmailer/src) simplepie/simplepie version 1.5.5 in (/var/www/html/g952/vendor/simplepie/simplepie/library) tecnickcom/tcpdf version 6.3.5 in (/var/www/html/g952/vendor/tecnickcom/tcpdf) michelf/php-markdown in (/var/www/html/g952/vendor/michelf/php-markdown/Michelf) true/punycode in (/var/www/html/g952/vendor/true/punycode/src) iamcal/lib_autolink in (/var/www/html/g952/vendor/iamcal/lib_autolink) sabre/dav in (/var/www/html/g952/vendor/sabre/dav/lib/DAV) sabre/http in (/var/www/html/g952/vendor/sabre/http/lib) sabre/uri in (/var/www/html/g952/vendor/sabre/uri/lib) sabre/vobject in (/var/www/html/g952/vendor/sabre/vobject/lib) laminas/laminas-cache in (/var/www/html/g952/vendor/laminas/laminas-cache/src) laminas/laminas-i18n in (/var/www/html/g952/vendor/laminas/laminas-i18n/src) laminas/laminas-serializer in (/var/www/html/g952/vendor/laminas/laminas-serializer/src) monolog/monolog in (/var/www/html/g952/vendor/monolog/monolog/src/Monolog) sebastian/diff in (/var/www/html/g952/vendor/sebastian/diff/src) elvanto/litemoji in (/var/www/html/g952/vendor/elvanto/litemoji/src) symfony/console in (/var/www/html/g952/vendor/symfony/console) scssphp/scssphp in (/var/www/html/g952/vendor/scssphp/scssphp/src) laminas/laminas-mail in (/var/www/html/g952/vendor/laminas/laminas-mail/src/Protocol) laminas/laminas-mime in (/var/www/html/g952/vendor/laminas/laminas-mime/src) rlanvin/php-rrule in (/var/www/html/g952/vendor/rlanvin/php-rrule/src) blueimp/jquery-file-upload in (/var/www/html/g952/vendor/blueimp/jquery-file-upload/server/php) ramsey/uuid in (/var/www/html/g952/vendor/ramsey/uuid/src) psr/log in (/var/www/html/g952/vendor/psr/log/Psr/Log) psr/simple-cache in (/var/www/html/g952/vendor/psr/simple-cache/src) mexitek/phpcolors in (/var/www/html/g952/vendor/mexitek/phpcolors/src/Mexitek/PHPColors) guzzlehttp/guzzle in (/var/www/html/g952/vendor/guzzlehttp/guzzle/src) guzzlehttp/psr7 in (/var/www/html/g952/vendor/guzzlehttp/psr7/src) wapmorgan/unified-archive in (/var/www/html/g952/vendor/wapmorgan/unified-archive/src) paragonie/sodium_compat in (/var/www/html/g952/vendor/paragonie/sodium_compat/src) phpCas version 1.3.3 in (/usr/share/php)

accounts             Name: Accounts                       Version: 2.6.0      State: Installed / not activated  activity             Name: Activities                     Version: 3.0.0      State: Installed / not activated  actualtime           Name: ActualTime                     Version: 1.4.0      State: Installed / not activated  fields               Name: Additional Fields              Version: 1.12.0     State: Installed / not activated  advancedplanning     Name: advancedplanning               Version: 0.2.0      State: Installed / not activated  news                 Name: Alerts                         Version: 1.8.0      State: Installed / not activated  archisw              Name: Apps structures                Version: 2.2.1      State: Installed / not activated  cleanarchivedemails  Name: Archived eMail clean           Version: 1.3.1      State: Installed / not activated  impacts              Name: Asset impacts                  Version: 1.3.7      State: Not installed  badges               Name: Badges                         Version: 2.6.0      State: Installed / not activated  barcode              Name: Barcode                        Version: 2.5.0      State: Installed / not activated  behaviors            Name: Behaviours                     Version: 2.4.1      State: Installed / not activated  positions            Name: Cartography                    Version: 4.7BetaMio State: Installed / not activated  childticketmanager   Name: Child ticket manager           Version: 2.1.3      State: Not installed  cmdb                 Name: CMDB                           Version: 2.2.1      State: Installed / not activated  consumables          Name: Consumable request             Version: 1.5.0      State: Not installed  costs                Name: Costs                          Version: 1.3.0      State: Installed / not activated  credit               Name: Credit vouchers                Version: 1.8.0      State: Installed / not activated  dashboard            Name: Dashboard                      Version: 0.9.9      State: Installed / not activated  datainjection        Name: Data injection                 Version: 2.8.0      State: Installed / not activated  databases            Name: Databases                      Version: 2.3.0      State: Installed / not activated  dataflows            Name: Dataflows                      Version: 2.2.1      State: Installed / not activated  archimap             Name: Diagrams                       Version: 2.2.1      State: Installed / not activated  domains              Name: Domains                        Version: 2.2.1      State: Installed / not activated  environment          Name: Environment                    Version: 2.4.1      State: Installed / not activated  escalade             Name: Escalation                     Version: 2.6.0      State: Installed / not activated  father               Name: Father&Sons                    Version: 1.2.0      State: Installed / not activated  financialreports     Name: Financial reports              Version: 2.6.0      State: Not installed  formcreator          Name: Form Creator                   Version: 2.10.3     State: Installed / not activated  formvalidation       Name: Form Validation                Version: 0.6.8      State: Not installed  archifun             Name: Functional Areas               Version: 2.2.1      State: Not installed  fusioninventory      Name: FusionInventory                Version: 9.5.0+1.0  State: Installed / not activated  gdrive               Name: GDrive                         Version: 1.3.0      State: Installed / not activated  airwatch             Name: GLPi Airwatch Connector        Version: 1.5.0      State: Installed / not activated  dev                  Name: GLPI Development Helper        Version: 1.0.0      State: Installed / not activated  mod                  Name: GLPI Modifications             Version: 2.0.2      State: Installed / not activated  resources            Name: Human Resources                Version: 2.7.0      State: Installed / not activated  sccm                 Name: Interface - SCCM               Version: 2.2.1      State: Not installed  geninventorynumber   Name: Inventory number generation    Version: 2.5.0      State: Installed / not activated  addressing           Name: IP Adressing                   Version: 2.9.0      State: Installed / not activated  uninstall            Name: Item's Lifecycle (uninstall)   Version: 2.7.0      State: Installed / not activated  itilcategorygroups   Name: ItilCategory Groups            Version: 2.4.0      State: Installed / not activated  jamf                 Name: JAMF Plugin for GLPI           Version: 2.1.2      State: Installed / not activated  jsaddons             Name: JS Addons                      Version: 1.0.0      State: Installed / not activated  livechat             Name: Livechat                       Version: 1.0.4      State: Installed / not activated  mailanalyzer         Name: Mail Analyzer                  Version: 1.6.1      State: Not installed  mantis               Name: MantisBT synchronization       Version: 4.4.0      State: Not installed  mask                 Name: Mask                           Version: 2.3.0      State: Not installed  metademands          Name: Meta-Demands                   Version: 2.7.3      State: Installed / not activated  metabase             Name: metabase                       Version: 1.2.0      State: Not installed  mreporting           Name: More Reporting                 Version: 1.7.0      State: Installed / not activated  satisfaction         Name: More satisfaction              Version: 1.5.0      State: Installed / not activated  moreticket           Name: More ticket                    Version: 1.6.0      State: Installed / not activated  mydashboard          Name: My Dashboard                   Version: 1.8.0      State: Not installed  notifications        Name: Notifications                  Version: 9.4+1.0    State: Not installed  oauthimap            Name: Oauth IMAP                     Version: 1.0.0      State: Installed / not activated  genericobject        Name: Objects management             Version: 2.9.1      State: Installed / not activated  ocsinventoryng       Name: OCS Inventory NG               Version: 1.7.2      State: Installed / not activated  officeonline         Name: Office Online                  Version: 1.3.2      State: Not installed  order                Name: Orders management              Version: 2.6.0      State: Installed / not activated  additionalalerts     Name: Others alerts                  Version: 2.2.0      State: Not installed  phpsaml              Name: PHP SAML                       Version: 1.0.0      State: Installed / not activated  pdf                  Name: Print to pdf                   Version: 1.7.0      State: Installed / not activated  printercounters      Name: Printer counters               Version: 1.7.0      State: Installed / not activated  processmaker         Name: Process Maker                  Version: 3.6.5      State: Not installed  projectbridge        Name: Projectbridge                  Version: 2.3RC2     State: Installed / not activated  protocolsmanager     Name: Protocols manager              Version: 1.4        State: Installed / not activated  releases             Name: Releases                       Version: 1.0.0      State: Installed / not activated  reports              Name: Reports                        Version: 1.14.0     State: Installed / not activated  reservation          Name: Reservation                    Version: 2.3.3      State: Installed / not activated  screenshot           Name: Screenshot                     Version: 1.0.0      State: Installed / not activated  shellcommands        Name: Shell Commands                 Version: 2.3.0      State: Not installed  statecheck           Name: Statecheck Rules               Version: 2.2.1      State: Not installed  manufacturersimports Name: Suppliers imports              Version: 2.3.0      State: Installed / not activated  tag                  Name: Tag Management                 Version: 2.8.0      State: Installed / not activated  taskdrop             Name: TaskDrop                       Version: 1.2.0      State: Installed / not activated  tasklists            Name: Tasks list                     Version: 1.6.0      State: Installed / not activated  ticketcleaner        Name: Ticket Cleaner                 Version: 2.5.1      State: Installed / not activated  timelineticket       Name: Timeline of tickets            Version: 9.4+1.0    State: Not installed  timezones            Name: Timezones                      Version: 2.5.2      State: Installed / not activated  treeview             Name: Tree view                      Version: 1.9.0      State: Installed / not activated  typology             Name: Typologies                     Version: 3.0.0      State: Installed / not activated  useditemsexport      Name: Used items export              Version: 2.4.0      State: Installed / not activated  webapplications      Name: Web applications               Version: 3.0.0      State: Installed / not activated  webresources         Name: Web Resources                  Version: 1.3.0      State: Installed / not activated  xivo                 Name: xivo                           Version: 1.0.0      State: Installed / not activated  yagp                 Name: yagp                           Version: 1.1.0      State: Installed / not activated
[/code]
tomolimo commented 4 years ago

Hello @jcervantes-sipecom

I know this bug 😃

It's a bug in MariaDB when changing the DATETIME fields into TIMESTAMP, see: https://github.com/tomolimo/timezones/issues/16 and https://github.com/tomolimo/timezones/issues/24

I had also this issue in the Timezones plugin...

The only way is to edit the default values for the TIMESTAMP fields and to set them to NULL

Thank you Regards, Tomolimo

jcervantes-sipecom commented 4 years ago

@tomolimo thank you so much for your soon reply, I read the 2 links you post, and you were right, I got some fields with that values:

show columns from glpi_tickets where `Default`= '2038-01-18 22:14:07';
+--------------------------+-----------+------+-----+---------------------+-------+
| Field                    | Type      | Null | Key | Default             | Extra |
+--------------------------+-----------+------+-----+---------------------+-------+
| date                     | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| closedate                | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| solvedate                | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| date_mod                 | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| time_to_resolve          | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| time_to_own              | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| begin_waiting_date       | timestamp | YES  |     | 2038-01-18 22:14:07 |       |
| internal_time_to_resolve | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| internal_time_to_own     | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| date_creation            | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
+--------------------------+-----------+------+-----+---------------------+-------+
show columns from glpi_tickettasks where `Default`= '2038-01-18 22:14:07';
+---------------+-----------+------+-----+---------------------+-------+
| Field         | Type      | Null | Key | Default             | Extra |
+---------------+-----------+------+-----+---------------------+-------+
| date          | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| begin         | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| end           | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| date_mod      | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| date_creation | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
+---------------+-----------+------+-----+---------------------+-------+
show columns from glpi_users where `Default`= '2038-01-18 22:14:07';
+----------------------------+-----------+------+-----+---------------------+-------+
| Field                      | Type      | Null | Key | Default             | Extra |
+----------------------------+-----------+------+-----+---------------------+-------+
| last_login                 | timestamp | YES  |     | 2038-01-18 22:14:07 |       |
| date_mod                   | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| date_sync                  | timestamp | YES  |     | 2038-01-18 22:14:07 |       |
| password_forget_token_date | timestamp | YES  |     | 2038-01-18 22:14:07 |       |
| personal_token_date        | timestamp | YES  |     | 2038-01-18 22:14:07 |       |
| api_token_date             | timestamp | YES  |     | 2038-01-18 22:14:07 |       |
| cookie_token_date          | timestamp | YES  |     | 2038-01-18 22:14:07 |       |
| begin_date                 | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| end_date                   | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
| date_creation              | timestamp | YES  | MUL | 2038-01-18 22:14:07 |       |
+----------------------------+-----------+------+-----+---------------------+-------+

Is there any way to search the database all tables with this default value and change it to NULL? Instead of doing it table by table.

tomolimo commented 4 years ago

Hello @jcervantes-sipecom

There is a way to fix this: to write a PHP script to get all TIMESTAMP fields from the mysql DB, and to ALTER each field changing the default value to NULL instead of the current default value.

And more than that, the timezone migration script must be fixed to prevent such issue in future.

Thank you, Reards, Tomolimo

jcervantes-sipecom commented 4 years ago

Thank you so much @tomolimo,I was reviewing table by table of GLPI and its plugins with the graphical tool DBeaver, and I found some tables that have fields with this problem of the Default date, likewise I have verified that there are fields, few but there are, that cannot be NULL. So at the moment I am changed in the production base and the test base these fields, depending on my criteria, I put them NULL or else CURRENT_TIMESTAMP.

tomolimo commented 4 years ago

Hello @jcervantes-sipecom Could you give a list of what you have done? Thank you Regards, Tomolimo

jcervantes-sipecom commented 4 years ago

Sure let me prepare a complete list of what I've been doing.

I will list like this:

Give me this week to finish it.

github-actions[bot] commented 3 years ago

There has been no activity on this issue for some time and therefore it is considered stale and will be closed automatically in 10 days.

If this issue is related to a bug, please try to reproduce on latest release. If the problem persist, feel free to add a comment to revive this issue. If it is related to a new feature, please open a topic to discuss with community about this enhancement on suggestion website.

You may also consider taking a subscription to get professionnal support or contact GLPI editor team directly.