-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Merge release 3.5.1 into 3.6.x #76
Commits on Dec 2, 2021
-
fix: autoconvert strftime formats to ICU, and use IntlDateFormatter f…
…or access log request representations AccessLogFormatter calls on AccesLogDataMap to format a number of strings, including request times; these are generally used in cookies and/or header values. Previously, we used `strftime()` to format date/time values. However, this is deprecated starting in PHP 8.1, with the recommendation of using `IntlDateFormatter` for purposes of formatting date/time strings in a locale-specific way. Because I'm unclear on whether the formats will always come from internal classes, or if they might come from external sources (e.g., cookie values), I've created a new final class, `Mezzio\Swoole\StrftimeToICUFormatMap` for mapping strftime formats to the ICU equivalents. I've added some basic tests for the class, which include demonstrating that the formats we use internally all get translated correctly. I've also added a test case for `AccessLogDataMap::getRequestTime()` to demonstrate that it generates the same values. Targeting the 3.5 series, as this is technically a bug in our PHP 8.1 support. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Configuration menu - View commit details
-
Copy full SHA for 3190046 - Browse repository at this point
Copy the full SHA 3190046View commit details
Commits on Dec 3, 2021
-
fix: mark StrftimeToICUFormatMap internal
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Configuration menu - View commit details
-
Copy full SHA for cda68e9 - Browse repository at this point
Copy the full SHA cda68e9View commit details -
refactor: remove unneeded sprintf
Since an ICU format can contain additional characters, we can wrap the returned format in the `[]` characters via concatenation instead. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Configuration menu - View commit details
-
Copy full SHA for e259bbd - Browse repository at this point
Copy the full SHA e259bbdView commit details -
qa: suppress errors due to usage of @internal StrftimeToICUFormatMap …
…in tests Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Configuration menu - View commit details
-
Copy full SHA for 22c7e99 - Browse repository at this point
Copy the full SHA 22c7e99View commit details -
fix: pass DateTimeImmutable instead of calling time()
The StrftimeToICUFormatMap case for `%s` was calling `return time()`, which (a) was the incorrect type (a string should be returned), and (b) could lead to a mismatch between the request time and what is reported in the logs. StrftimeToICUFormatMap::mapStrftimeToICU now accepts a second argument, a DateTimeInterface $requestTime, and this is used when `%s` is in the format. AccessLogDataMap::getRequestTime creates a DateTimeImmutable instance from the server $request_time_float property and passes that value to StrftimeToICUFormatMap. Creation of the callback for preg_replace_callback has been moved to another method, based on issues reported by Psalm; the callback now has full typehinting as well. Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Configuration menu - View commit details
-
Copy full SHA for 3e47454 - Browse repository at this point
Copy the full SHA 3e47454View commit details -
Merge pull request #75 from weierophinney/hotfix/strftime-deprecated
Fix deprecation in request time formatting for access logs
Configuration menu - View commit details
-
Copy full SHA for 67de950 - Browse repository at this point
Copy the full SHA 67de950View commit details