php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34052 [PATCH] date('U') returns %ld not unix timestamp
Submitted: 2005-08-09 18:10 UTC Modified: 2005-09-15 21:11 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: ash at theleys dot net Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5CVS-2005-09-03 OS: win32 only
Private report: No CVE-ID: None
 [2005-08-09 18:10 UTC] ash at theleys dot net
Description:
------------
date('U') returns %ld not unix timestamp

Straight CGI (Fast CGI), ini set by installer, unchanged otherwise, worked under 5.04

Reproduce code:
---------------
<?php
echo date('U');
?>

Expected result:
----------------
Unix timestamp, not, what looks like, an uninterpreted sprintf

Actual result:
--------------
%ld

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-04 14:52 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Please try the snapshot then.
 [2005-09-04 19:01 UTC] ash at theleys dot net
Hi, have tried snapshot. Still same. date('u') on PHP 4.3 still works (on another server) on IIS6 (so Windows Server 2003).
Thanks for looking in to this, Alan
 [2005-09-04 19:58 UTC] nlopess@php.net
Bah, forget my last post.
As timelib_sll is defined as __int64, we should use printf(%I64d) on windows.
 [2005-09-04 20:04 UTC] derick@php.net
We (should) use PHP's internal printing routines, this has nothing to do with the platform. It works fine here.
 [2005-09-04 22:10 UTC] nlopess@php.net
OK, now I see you are using PHP's sprintf implementation.
The problem is there. It only accepts  %lld if SIZEOF_LONG_LONG is true. However, config.w32.h defines it as 0, so %lld is disabled on windows.
 [2005-09-04 23:42 UTC] sniper@php.net
Derick brakes, Derick fixes. :)

 [2005-09-04 23:42 UTC] sniper@php.net
s/brakes/breaks/

 [2005-09-05 08:06 UTC] derick@php.net
Don't assign things to me which I can't test. This is a bug in the port to Windows.
 [2005-09-05 08:58 UTC] sniper@php.net
Derick, you got to be kidding? I know you have a windows machine to test with at work, so TEST it..

 [2005-09-05 12:06 UTC] nlopess@php.net
I couldn't test this patch because I haven't installed MSVC yet, but I think it should work.
http://mega.ist.utl.pt/~ncpl/php_34052_patch.txt
 [2005-09-15 20:55 UTC] nlopess@php.net
Finally I've installed Microsoft Visual Studio .Net!
I've tested the patch and it works fine.
 [2005-09-15 21:11 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fixed in PHP 5.1 and PHP 6.0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC