#44752 [Opn->Bgs]: Crash with new DateTimeZone(null)

From: Date: Thu, 17 Apr 2008 10:52:49 +0000
Subject: #44752 [Opn->Bgs]: Crash with new DateTimeZone(null)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124313@lists.php.net to get a copy of this message
ID: 44752 Updated by: felipe@php.net Reported By: daniel dot oconnor at gmail dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Windows XP PHP Version: 5.2.5 New Comment: Output using 5.2.6: object(DateTimeZone)#1 (0) { } Warning: timezone_open(): Unknown or bad timezone () in ... bool(false) Warning: timezone_open(): Unknown or bad timezone () in ... bool(false) object(DateTimeZone)#1 (0) { } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone ()' in ... Stack trace: #0 ...(17): DateTimeZone->__construct('') #1 {main} thrown in ... Then, it looks has been fixed. Previous Comments: ------------------------------------------------------------------------ [2008-04-17 08:06:51] daniel dot oconnor at gmail dot com Description: ------------ new DateTimeZone crashes apache when given something it can't recognize. timezone_open is more robust This has similar symptoms to Bug #43377 ; but is probably different Reproduce code: --------------- <?php $dt = timezone_open("Australia/Adelaide"); var_dump($dt); $dt = timezone_open(""); var_dump($dt); $dt = timezone_open(null); var_dump($dt); $dt = new DateTimeZone("Australia/Adelaide"); var_dump($dt); $dt = new DateTimeZone(""); var_dump($dt); $dt = new DateTimeZone(null); var_dump($dt); Expected result: ---------------- object(DateTimeZone)#1 (0) { } bool(false) bool(false) object(DateTimeZone)#1 (0) { } bool(false) bool(false) Actual result: -------------- object(DateTimeZone)#1 (0) { } bool(false) bool(false) object(DateTimeZone)#1 (0) { } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44752&edit=1

« previous php.bugs (#124313) next »