Using 64-bit Wamp Server, Dates Beyond January 2038 Aren't Handled Properly
Posted by: Len_Jacobson (---.hsd1.ca.comcast.net)
Date: March 24, 2016 08:15AM

I have PHP code that uses the 'Date' object. I am dealing with retirement dates, many of which are beyond January 2038 when a 4-byte time epoch won't work. The 'Date' object is supposed to work with dates beyond this limit, and, indeed, my code works perfectly fine when I run it on a Linux server. But on my 64-bit Wamp server, it doesn't work.

On the Linux server, an array has an element that is a time epoch whose value is:

[retire_date_time_epoch] => 2165443200

The very same code running with the same data on my 64-bit Wamp server results in:

[retire_date_time_epoch] => -2129524096

Why doesn't this code work correctly on the 64-bit Wamp server?

Thank you.

Len Jacobson

Options: ReplyQuote
Re: Using 64-bit Wamp Server, Dates Beyond January 2038 Aren't Handled Properly
Posted by: RiggsFolly (Moderator)
Date: March 24, 2016 10:02AM

Hi Len

What version of PHP is running in each environment?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Using 64-bit Wamp Server, Dates Beyond January 2038 Aren't Handled Properly
Posted by: Otomatic (Moderator)
Date: March 24, 2016 10:15AM

Hi,

Under Windows 64 bit, PHP integers with more than 32 bits works ONLY with PHP 7.x.y 64 bits.

Example with Windows 7 Pro 64 bits, Wampserver 3.0.4 64 bits with Apache 2.4.18, PHP 7.0.4 and MySQL 5.7.11 all in 64 bits versions.
echo "<h3>Integers more than 32 bits</h3>\n";
$integer = array(
'retire_date_time_epoch' => 2165443200,
'retire_date_time_epoch1' => 2165443333,
'retire_date_time_epoch2' => 12165443333,
'retire_date_time_epoch3' => 1222165443333,
'retire_date_time_epoch4' => 123652165443333,
'retire_date_time_epoch5' => 569844442165443333,
'retire_date_time_epoch6' => 8569844442165443333,
);
foreach($integer as $key => $value) {
	echo "<p>".$key." = ".$value."</p>\n";
}
Result
Integers more than 32 bits

retire_date_time_epoch = 2165443200
retire_date_time_epoch1 = 2165443333
retire_date_time_epoch2 = 12165443333
retire_date_time_epoch3 = 1222165443333
retire_date_time_epoch4 = 123652165443333
retire_date_time_epoch5 = 569844442165443333
retire_date_time_epoch6 = 8569844442165443333

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons



Edited 1 time(s). Last edit at 03/24/2016 10:23AM by Otomatic.

Options: ReplyQuote
Re: Using 64-bit Wamp Server, Dates Beyond January 2038 Aren't Handled Properly
Posted by: Len_Jacobson (---.hsd1.ca.comcast.net)
Date: March 24, 2016 03:39PM

RiggsFolly -- the version of PHP running on my 64-bit Wamp server is 5.6.16; the version running on my Linux server is 5;4.45.

Otomatic -- you have clearly answer my question by saying that on the 64-bit Wamp server, I must be running PHP 7.x.y.

Thank you both for your responses. I do appreciate your help!!

Len Jacobson

Options: ReplyQuote
Re: Using 64-bit Wamp Server, Dates Beyond January 2038 Aren't Handled Properly
Posted by: RiggsFolly (Moderator)
Date: March 24, 2016 05:15PM

If code is written for PHP 5.4 you may fond other issues when upgrading to PHP7 it is a very dofferent beast.

As to your issue, the DateTime objct does cope with 64 integers, but as soon as you move data out of the object into a scalar integer you will have problems

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.