-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DateTimeZone fails to parse time zones that contain the "+" character #10218
Comments
As per https://www.php.net/manual/en/timezones.others.php this can be expected behaviour as you should not use those! Depending on the implemented timezone-db this can break. |
This behavioral change has likely been introduced by fixing #9700. |
i'm in favor of reverting to previous code, user side it's easy to interpret even if you use convert it's good for 3rd party code <?php
$date = date_create();
$date = date_create('1970-01-01 00:00:00 +' . date_format($date, 'U') . 'sec', timezone_open('UTC'));
$usercode_tz = timezone_open('Etc/GMT+1'); // UTC-1
date_timezone_set($date, $usercode_tz);
$date_display = date_format($date, 'Y-m-d\\TH:i:s e');
$user_display = str_replace(' ', ' [', $date_display) . ']';
$convert_user_display = str_replace(array(' [', ']'), '', $user_display);
var_dump($convert_user_display);
?> |
Looks like this also affects 8.1.14 |
Can confirm this issue affects >= 8.1.14 and is not present in versions bellow. Docker - 8.1.13
Docker - 8.1.14
|
Description
The following code:
Resulted in this output:
But I expected this output instead:
3v4l.org link: https://3v4l.org/bGhje#v8.2.1
Looks like it broke after the latest
timelib
update. Looking through the recent changes, it seems that the+
character is not considered in this lookup function.@derickr Could you take a look at this?
PHP Version
PHP 8.2.1 RC1
Operating System
No response
The text was updated successfully, but these errors were encountered: