diff --git a/CHANGELOG b/CHANGELOG index fa856e1..67c3cab 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +Version 0.1?.? (2022-??-??) +=========================== + +Bug fixes: +- Perform MySQL table maintenance more reliably + Version 0.10.2 (2022-04-04) =========================== diff --git a/lib/Db/MySQL/Driver.php b/lib/Db/MySQL/Driver.php index 9aca818..c61762a 100644 --- a/lib/Db/MySQL/Driver.php +++ b/lib/Db/MySQL/Driver.php @@ -224,7 +224,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { public function maintenance(): bool { // with MySQL each table must be analyzed separately, so we first have to get a list of tables - foreach ($this->query("SHOW TABLES like 'arsse\\_%'") as $table) { + foreach ($this->query("SHOW TABLES like 'arsse%'") as $table) { $table = array_pop($table); if (!preg_match("/^arsse_[a-z_]+$/D", $table)) { // table is not one of ours diff --git a/lib/Misc/ValueInfo.php b/lib/Misc/ValueInfo.php index 8b31590..d03949c 100644 --- a/lib/Misc/ValueInfo.php +++ b/lib/Misc/ValueInfo.php @@ -283,12 +283,8 @@ class ValueInfo { } return $out->setTimezone(new \DateTimeZone("UTC")); } else { - $out = new \DateTimeImmutable($value, new \DateTimeZone("UTC")); - if ($out) { - return $out->setTimezone(new \DateTimeZone("UTC")); - } elseif ($strict && !$drop) { - throw new \Exception; - } + // if the string fails to parse it will produce an exception which is caught just below + return (new \DateTimeImmutable($value, new \DateTimeZone("UTC")))->setTimezone(new \DateTimeZone("UTC")); } } catch (\Exception $e) { if ($strict && !$drop) { diff --git a/tests/cases/Misc/TestValueInfo.php b/tests/cases/Misc/TestValueInfo.php index e17be63..d6f39b2 100644 --- a/tests/cases/Misc/TestValueInfo.php +++ b/tests/cases/Misc/TestValueInfo.php @@ -568,7 +568,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { null, ]; foreach ([ - /* Input value microtime iso8601 iso8601m http sql date time unix float '!M j, Y (D)' *strtotime* (null) */ + /* Input value microtime iso8601 iso8601m http sql date time unix float '!M j, Y (D)' *strtotime* (null) */ [null, null, null, null, null, null, null, null, null, null, null, null], [INF, null, null, null, null, null, null, null, null, null, null, null], [NAN, null, null, null, null, null, null, null, null, null, null, null], @@ -600,7 +600,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { [[], null, null, null, null, null, null, null, null, null, null, null], [$this->i("P1Y2D"), null, null, null, null, null, null, null, null, null, null, null], ["P1Y2D", null, null, null, null, null, null, null, null, null, null, null], - ] as $set) { + ] as $k => $set) { // shift the input value off the set $input = array_shift($set); // generate a set of tests for each target date formats @@ -612,7 +612,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest { [false, true], [true, true], ] as [$strict, $drop]) { - yield [$input, $formats[$format], $exp, $strict, $drop]; + yield "Index #$k format \"$format\" strict:$strict drop:$drop" => [$input, $formats[$format], $exp, $strict, $drop]; } } }