From: hunreal at gmail dot com
Operating system: Windows, FreeBSD
PHP version: 5.2.6
PHP Bug Type: OpenSSL related
Bug description: validFrom_time_t of certificate in Windows is difference with
Unix system
Description:
------------
I used openssl_x509_parse() to get certificate infomation. But the values,
'validFrom_time_t' and 'validTo_time_t' in Windows is difference with Unix
system.
It's same php code, same certificate file. But two result is not the
same.
By used openssl CLI, I am sure that is Windows PHP issue.
Reproduce code:
---------------
PHP code:
<?php
$crtinfo = openssl_x509_parse(file_get_contents("my.cer"));
echo $crtinfo['validFrom']," ",$crtinfo['validFrom_time_t'],"\n";
echo $crtinfo['validTo']," ",$crtinfo['validTo_time_t'],"\n";
echo date("Y-m-d H:i:s", $crtinfo['validFrom_time_t']),"\n";
echo date("Y-m-d H:i:s", $crtinfo['validTo_time_t']),"\n";
?>
Openssl CLI:
openssl x509 -dates -noout -in my.cer
You can use any certificate.
Expected result:
----------------
In windows, PHP code output,
070126220002Z 1169845202
090126033531Z 1232937331
2007-01-27 05:00:02
2009-01-26 10:35:31
------------------------------
In Unix, PHP code output,
070126220002Z 1169848802
090126033531Z 1232940931
2007-01-27 06:00:02
2009-01-26 11:35:31
------------------------------
BTW, my timezone is set to Asia/Shanghai, GMT+8
Actual result:
--------------
OpenSSL CLI output,
notBefore=Jan 26 22:00:02 2007 GMT
notAfter=Jan 26 03:35:31 2009 GMT
--
Edit bug report at http://bugs.php.net/?id=46747&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46747&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46747&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46747&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=46747&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=46747&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=46747&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=46747&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=46747&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=46747&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=46747&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=46747&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46747&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46747&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=46747&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46747&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46747&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=46747&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=46747&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=46747&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=46747&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=46747&r=mysqlcfg