|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-04-17 08:06 UTC] 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) { } PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 01:00:01 2025 UTC |
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.