php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32425 mktime() - Out of range problem
Submitted: 2005-03-23 12:08 UTC Modified: 2005-03-29 10:08 UTC
From: dsacchet at kikamedical dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.10 OS: Linux 2.4.27
Private report: No CVE-ID: None
 [2005-03-23 12:08 UTC] dsacchet at kikamedical dot com
Description:
------------
hello,

I observed a misbehaviour with out of range value on
the mktime function. When I put a number of seconds
gretear than 59, mktime round up to 59 and don't
increment minutes ...

Best regards

Denis Sacchet


Reproduce code:
---------------
echo date("M-d-Y H:i:s", mktime(8, 0, 60, 12, 31, 1997));

Expected result:
----------------
08:01:00

Actual result:
--------------
08:00:59

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-23 12:52 UTC] derick@php.net
WOrks fine for me... which glibc do you use? dsitribution?
 [2005-03-23 14:09 UTC] dsacchet at kikamedical dot com
Here the complete description of my system :

Gentoo Linux stable branch updated to latest version
of portage.

uname -a :

Linux venus.kika.loc 2.4.27 #2 SMP Thu Nov 25 15:22:28 CET 2004 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GenuineIntel GNU/Linux

Glibc version :

sys-libs/glibc-2.3.4.20041102-r1

GCC :

i686-pc-linux-gnu-3.3.5

If you know the gentoo system, here is my USE flags :

USE="apache2 expat gd java mng mpeg4 native oci8 pcre pear-db php \
     plotutils regexp speedo sse type1 X509 -oss -apm -arts -avi -cups \
     -encode -foomaticdb -fortran -gnome -gpm -gtk -gtk2 -imlib -kde -libg \
     -mad -mikmod -motif -oggvorbis -opengl -qt -quicktime -sdl -X -xmms \
     -xv"

And finally, I can paste you the configure line from the
phpinfo :

'./configure' '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--with-apxs2=/usr/sbin/apxs2' '--with-ndbm=/usr' '--with-db4=/usr' '--with-mcrypt=/usr' '--with-mhash=/usr' '--without-interbase' '--without-ming' '--without-swf' '--without-sybase' '--with-gdbm=/usr' '--without-fdftk' '--with-java=/opt/sun-jdk-1.4.2.07' '--without-mcal' '--with-oci8=/u01/app/oracle/product/9.2.0.4.0' '--with-unixODBC=/usr' '--without-pgsql' '--with-snmp=/usr' '--enable-ucd-snmp-hack' '--without-gmp' '--without-mssql' '--with-pdflib=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-png=/usr' '--with-png-dir=/usr' '--with-jpeg=/usr' '--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff=/usr' '--with-tiff-dir=/usr' '--without-mysql' '--with-freetype-dir=/usr' '--with-ttf=/usr' '--with-t1lib=/usr' '--with-gettext' '--without-qtdom' '--with-pspell=/usr' '--with-openssl=/usr' '--without-imap' '--with-ldap=/usr' '--with-dom=/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--without-kerberos' '--with-pam' '--disable-memory-limit' '--enable-ipv6' '--without-yaz' '--disable-debug' '--with-curlwrappers' '--with-curl=/usr' '--enable-dbx' '--with-zlib=/usr' '--with-zlib-dir=/usr' '--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot' '--with-xmlrpc' '--enable-wddx' '--with-xml' '--enable-mbstring=all' '--enable-mbregex' '--with-bz2=/usr' '--with-crack=/usr' '--with-cdb' '--enable-pcntl' '--enable-bcmath' '--enable-calendar' '--enable-dbase' '--enable-filepro' '--enable-ftp' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-iconv' '--enable-shmop' '--enable-dio' '--enable-yp' '--without-ncurses' '--without-readline' '--enable-inline-optimization' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--with-config-file-path=/etc/php/apache2-php4' '--without-pear' '--libdir=/usr/lib/php'

Thank you very much for your help. I really appreciate that.

Best regards

Denis Sacchet
 [2005-03-23 23:42 UTC] sniper@php.net
Please try using this CVS snapshot:

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

And do exactly this:

# ./configure --disable-all --disable-cgi && make
# sapi/cli/php -r \
'echo date("M-d-Y H:i:s", mktime(8, 0, 60, 12, 31, 1997));'
 [2005-03-24 10:40 UTC] dsacchet at kikamedical dot com
# ./configure --disable-all --disable-cgi && make
creating cache ./config.cache
checking host system type... i686-pc-linux-gnu

...

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

venus php4-STABLE-200503240730 # sapi/cli/php -r \
> 'echo date("M-d-Y H:i:s", mktime(8, 0, 60, 12, 31, 1997))."\n\n";'
Dec-31-1997 08:00:59

venus php4-STABLE-200503240730 # 

So ... same result ... I become crazy ! :)

Do you want some output from the ./configure ?
 [2005-03-24 18:04 UTC] sniper@php.net
Can you try upgrading your GCC to 3.4.3 ?

 [2005-03-24 18:14 UTC] dsacchet at kikamedical dot com
It will be difficult to upgrade the gcc version because this
version is not stable onto gentoo. Do you want me to make
some test with C program. I have good notion of C programming
so if you tell me make a program like that, compile and
execute, I can do that (do you use the C mktime into the
php source ?)
 [2005-03-24 18:53 UTC] sniper@php.net
This is anyhow just problem with your system -> bogus.

 [2005-03-24 18:53 UTC] sniper@php.net
.
 [2005-03-25 12:58 UTC] dsacchet at kikamedical dot com
Hello,

I just upgraded GLIBC/GCC (both comes together) so to
glibc 2.3.4 and gcc 3.4.3 and everything is ok now.

Thanks for your diagnosis and help.

Best regards

Denis Sacchet
 [2005-03-29 09:56 UTC] dsacchet at kikamedical dot com
As a conclusion, the problem come either from the version
of glibc or version of gcc ... Upgrade of those software
solved the problems.

Thanks for your help
 [2005-03-29 10:08 UTC] tony2001@php.net
No PHP bug -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 02:01:29 2024 UTC