|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7526 unixtojd (-x) causes php.exe to crash
Submitted: 2000-10-30 01:07 UTC Modified: 2000-10-30 11:14 UTC
From: Assigned:
Status: Closed Package: Calendar related
PHP Version: 4.0.3pl1 OS: Win2k Pro.
Private report: No CVE-ID: None
 [2000-10-30 01:07 UTC]
Hello All,

Calls to unixtojd() with a negative integer value cause php.exe to exit. The problem cannot be reproduced on OpenBSD 2.7 running PHP 4.0.3 pl 1.

(For additional information, see below patch...)

My C skills are practically non-existant. However, it seems that a simple patch like:

--- cal_unix.c	Sun Oct 29 23:00:43 2000
+++ patch.c	Sun Oct 29 23:01:47 2000
@@ -39,6 +39,9 @@

   if(myargc==1) {
+    if(timestamp < 0) {
+      RETURN_FALSE;  /* before beginning of unix epoch */
+    }
     t = timestamp->value.lval;

I am probably wrong - but I thought that I should at least give a crack at fixing it. :)

I would test this patch myself, except I have no way to compile on the windows platform.

-- More info --

Windows generates a Program Error box with the following message: "php.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being generated."

No error is reported in the system logs.

The Apache (Apache 1.3.12) error log records the error:
Premature end of script headers: c:/program files/php4/php.exe


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-30 11:14 UTC]
Should be fixed in CVS, please reopen if still crashes.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 05:01:31 2024 UTC