php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21098 mktime crashes when certain parameters are passed
Submitted: 2002-12-19 09:57 UTC Modified: 2002-12-19 11:07 UTC
From: martin at tack dot se Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.3.0RC3 OS: Windows 2000
Private report: No CVE-ID: None
 [2002-12-19 09:57 UTC] martin at tack dot se
The following code makes apache (?) crash.
<?
$timestamp = 0;
$m = date("m",$timestamp); //$m = 01
$y = date("Y",$timestamp); //$m = 1970
$datestamp = mktime(0,0,0, $m, 0, $y);
?>

I use Apache 2.0.43 under Windows2k SP3.
I have tested against PHP 4.2.3, 4.3.0RC3 and a couple of 4.3.x-dev snapshots from snaps.php.net (from 16-18 dec 2002)
Script doesnt crash if either $m or $y is replaced with a 0 in the mktime() call.

I found this problem after investigating why a certain script crashed, the reason was some data that i've expected to be in the database actually wasn't. In this case i'd expect to get a false back in $datestamp, or some kind of error message.
I've searched the bug database but havent found any similar bug reports.

On Linux 2.4.14, PHP 4.2.3, Apache 1.3.27 i can NOT reproduce this problem.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-19 10:04 UTC] martin at tack dot se
Last tested with php4-win32-STABLE-200212190930.zip
and the bug still occurs.
Also, Apache says the following in error.log:

[Thu Dec 19 17:02:56 2002] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Thu Dec 19 17:02:56 2002] [notice] Parent: Created child process 2232
[Thu Dec 19 17:02:56 2002] [notice] Child 2232: Child process is running
[Thu Dec 19 17:02:56 2002] [notice] Child 2232: Acquired the start mutex.
[Thu Dec 19 17:02:56 2002] [notice] Child 2232: Starting 250 worker threads.
 [2002-12-19 10:12 UTC] edink@php.net
Verified on Windows. Crash happens in ext/standard/datetime.c in php_mktime() on line:

t2 = *localtime(&seconds);
 [2002-12-19 11:07 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 19:01:28 2024 UTC