mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.2'
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -661,9 +661,20 @@ static timelib_long timelib_get_month(const char **ptr)
|
||||
|
||||
static void timelib_eat_spaces(const char **ptr)
|
||||
{
|
||||
while (**ptr == ' ' || **ptr == '\t') {
|
||||
++*ptr;
|
||||
}
|
||||
do {
|
||||
if (**ptr == ' ' || **ptr == '\t') {
|
||||
++*ptr;
|
||||
continue;
|
||||
}
|
||||
if ((*ptr)[0] == '\xe2' && (*ptr)[1] == '\x80' && (*ptr)[2] == '\xaf') { // NNBSP
|
||||
*ptr += 3;
|
||||
continue;
|
||||
}
|
||||
if ((*ptr)[0] == '\xc2' && (*ptr)[1] == '\xa0') { // NBSP
|
||||
*ptr += 2;
|
||||
continue;
|
||||
}
|
||||
} while (false);
|
||||
}
|
||||
|
||||
static void timelib_eat_until_separator(const char **ptr)
|
||||
@@ -992,7 +1003,9 @@ std:
|
||||
/*!re2c
|
||||
any = [\000-\377];
|
||||
|
||||
space = [ \t]+;
|
||||
nbsp = [\302][\240];
|
||||
nnbsp = [\342][\200][\257];
|
||||
space = [ \t]+ | nbsp+ | nnbsp+;
|
||||
frac = "."[0-9]+;
|
||||
|
||||
ago = 'ago';
|
||||
@@ -1318,6 +1331,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr)
|
||||
s->time->s = timelib_get_nr(&ptr, 2);
|
||||
}
|
||||
}
|
||||
timelib_eat_spaces(&ptr);
|
||||
s->time->h += timelib_meridian(&ptr, s->time->h);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_TIME12;
|
||||
@@ -1745,6 +1759,9 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr)
|
||||
s->time->h = timelib_get_nr(&ptr, 2);
|
||||
s->time->i = timelib_get_nr(&ptr, 2);
|
||||
s->time->s = timelib_get_nr(&ptr, 2);
|
||||
|
||||
timelib_eat_spaces(&ptr);
|
||||
|
||||
s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
|
||||
@@ -1858,6 +1875,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr)
|
||||
DEBUG_OUTPUT("tzcorrection | tz");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_TZ();
|
||||
timelib_eat_spaces(&ptr);
|
||||
s->time->z = timelib_parse_zone(&ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb, tz_get_wrapper);
|
||||
if (tz_not_found) {
|
||||
add_error(s, TIMELIB_ERR_TZID_NOT_FOUND, "The timezone could not be found in the database");
|
||||
@@ -1936,7 +1954,12 @@ weekdayof = (reltextnumber|reltexttext) space (dayfulls|dayfull|dayabbr)
|
||||
return TIMELIB_RELATIVE;
|
||||
}
|
||||
|
||||
[ .,\t]
|
||||
[.,]
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
|
||||
space
|
||||
{
|
||||
goto std;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
# include "timelib_config.h"
|
||||
#endif
|
||||
|
||||
#define TIMELIB_VERSION 202207
|
||||
#define TIMELIB_EXTENDED_VERSION 20220701
|
||||
#define TIMELIB_ASCII_VERSION "2022.07"
|
||||
#define TIMELIB_VERSION 202208
|
||||
#define TIMELIB_EXTENDED_VERSION 20220801
|
||||
#define TIMELIB_ASCII_VERSION "2022.08"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
19
ext/date/tests/bug-gh11600.phpt
Normal file
19
ext/date/tests/bug-gh11600.phpt
Normal file
@@ -0,0 +1,19 @@
|
||||
--TEST--
|
||||
Bug GH-11600: Intl patterns are not parseable DateTime Strings
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
$formatter = new IntlDateFormatter('en_US', -1, 3);
|
||||
$pattern = $formatter->getPattern();
|
||||
|
||||
$timeString = $formatter->format(strtotime('2023-07-11 16:02'));
|
||||
|
||||
$timestamp = strtotime($timeString);
|
||||
|
||||
var_dump($pattern, $timeString, $timestamp);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(8) "h:mm a"
|
||||
string(9) "4:02 PM"
|
||||
int(1689091320)
|
||||
Reference in New Issue
Block a user