Mantis - Quercus
Viewing Issue Advanced Details
4556 crash always 05-16-11 08:01 05-20-11 02:17
thr  
domdorn  
normal  
resolved 4.0.14  
fixed  
none    
none  
0004556: date_create with time==null and timezone causes NPE
Calling function date_create (aca. new DateTime(null, $timezone_object ) with null and timezone object causes a NullPointerException.

Givin null as time is valid according to php documentation and should be similar to 'now'. (http://www.php.net/manual/de/datetime.construct.php) [^]

This works in native php Version PHP 5.3.3-1ubuntu9.5

Sample:
<?PHP

$timezone_string = 'Europe/London';
$timezone_object = timezone_open( $timezone_string );

$datetime = $date = new DateTime(null, $timezone_object );
echo '1 London: ' . date_format($datetime, DATE_ATOM);

$datetime = date_create( null, $timezone_object );
echo '2 London: ' . date_format($datetime, DATE_ATOM);
 
?>
 testdate.php [^] (326 bytes) 05-16-11 08:01
 0001-Fixing-c-4556-date_create-with-time-null-and-timezon.patch [^] (1,015 bytes) 05-17-11 02:14

Notes
(0005249)
kdecherf   
05-17-11 02:14   
A patch to fix this issue will be attached.
(0005268)
domdorn   
05-20-11 02:17   
php/1951

fixed in trunk, available in quercus 4.0.19