Limitations of 32-bit PHP
If you run Drupal on a system where PHP is compiled or restricted to using 32-bit integers, you will only be able to input dates between 1901 and 2038 (specifically from 20:45:52 UTC on December 13, 1901 to 03:14:07 UTC on January 19, 2038). This is commonly known as the Year 2038 problem.
A typical symptom is that the date displays or is stored as 1970-01-01 instead of the intended value outside the above range. This affects all PHP applications. Specifically, in Drupal, this affects date-based field types — date only and date/time — including the “Select list” widget. You can select years outside the 1900–2038 range, but because PHP itself cannot handle them, they will be stored/displayed as 1970-01-01 without warning.
Affected Products
- Official Windows builds for PHP 5.x / 7.x for x86 and PHP 5.x for x64.
- Any web stack package (XAMPP, Wamp, etc.) with PHP compiled for 32-bit and/or running in a 32-bit system.
- Acquia Dev Desktop 2 prior to the June 14, 2018 release (it now uses 64-bit PHP and MySQL).
Note: It’s how PHP itself is compiled that matters — if you have a 32-bit version of PHP running on a 64-bit OS, you will still face the issue.
Testing
To check if your PHP installation is affected, run this command (on a single line):
php -r "echo (date('y',strtotime('2039-01-01')) == 39 ? 'OK' : 'Y2K38 limitation') . PHP_EOL;"
An unaffected PHP instance will print OK, while a vulnerable PHP instance will print Y2K38 limitation.
Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.