Revert early return from QTimeZone on invalid ID
This reverts commit ec8808c3020abbc436f1a2d90fecf3245fd6417b but retains its test, as the problem it fixed is now solved by having the TZ backend validate the ID it's passed, so that it now only accepts valid POSIX zone-descriptions and valid IANA IDs. The former were being excluded by this check. Amended a POSIX test to fail with the check in place; it passes now. Change-Id: I0d5e8c6e0a315ac2509f3d23bebb52aede8f79d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Robert Löhning <robert.loehning@qt.io>
This commit is contained in:
parent
ae5d40e674
commit
16c9683718
@ -334,9 +334,6 @@ QTimeZone::QTimeZone() noexcept
|
|||||||
|
|
||||||
QTimeZone::QTimeZone(const QByteArray &ianaId)
|
QTimeZone::QTimeZone(const QByteArray &ianaId)
|
||||||
{
|
{
|
||||||
// If invalid (other than empty), reject immediately:
|
|
||||||
if (!ianaId.isEmpty() && !QTimeZonePrivate::isValidId(ianaId))
|
|
||||||
return;
|
|
||||||
// Try and see if it's a CLDR UTC offset ID - just as quick by creating as
|
// Try and see if it's a CLDR UTC offset ID - just as quick by creating as
|
||||||
// by looking up.
|
// by looking up.
|
||||||
d = new QUtcTimeZonePrivate(ianaId);
|
d = new QUtcTimeZonePrivate(ianaId);
|
||||||
|
@ -1138,7 +1138,7 @@ void tst_QTimeZone::tzTest()
|
|||||||
QVERIFY(tzp.isValid());
|
QVERIFY(tzp.isValid());
|
||||||
|
|
||||||
// Test POSIX-format value for $TZ:
|
// Test POSIX-format value for $TZ:
|
||||||
QTzTimeZonePrivate tzposix("MET-1METDST-2,M3.5.0/02:00:00,M10.5.0/03:00:00");
|
QTimeZone tzposix("MET-1METDST-2,M3.5.0/02:00:00,M10.5.0/03:00:00");
|
||||||
QVERIFY(tzposix.isValid());
|
QVERIFY(tzposix.isValid());
|
||||||
QVERIFY(tzposix.hasDaylightTime());
|
QVERIFY(tzposix.hasDaylightTime());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user