PHP 4.0 Bug #7526: unixtojd (-x) causes php.exe to crash

From: Date: Mon, 30 Oct 2000 06:07:18 +0000
Subject: PHP 4.0 Bug #7526: unixtojd (-x) causes php.exe to crash
Groups: php.dev 
Request: Send a blank email to php-dev+get-36379@lists.php.net to get a copy of this message
From: zak@php.net Operating system: Win2k Pro. PHP version: 4.0.3pl1 PHP Bug Type: Calendar related Bug description: unixtojd (-x) causes php.exe to crash 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 */ + } + convert_to_long(timestamp); 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 -- Edit Bug report at: http://bugs.php.net/?id=7526&edit=1

« previous php.dev (#36379) next »