diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index af5c8b7d1..44245b439 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -1233,9 +1233,14 @@ private static function getNotificationUuid(string $notification): string { // Not a UUID, maybe a JSON object? try { $json = json_decode($notification, NULL, 4, JSON_THROW_ON_ERROR); - return CommandBase::getNotificationUuidFromResponse($json); + if (is_object($json)) { + return self::getNotificationUuidFromResponse($json); + } + // In rare cases, JSON can decode to a string that's a valid UUID. + self::validateUuid($json); + return $json; } - catch (JsonException | AcquiaCliException) { + catch (JsonException | AcquiaCliException | ValidatorException) { } // Last chance, maybe a URL? diff --git a/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php b/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php index 05f5c22b7..03525a3cd 100644 --- a/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php +++ b/tests/phpunit/src/Commands/App/TaskWaitCommandTest.php @@ -84,6 +84,9 @@ public function providerTestTaskWaitCommand(): array { } EOT, ], + [ + '"1bd3487e-71d1-4fca-a2d9-5f969b3d35c1"', + ], ]; } @@ -148,6 +151,9 @@ public function providerTestTaskWaitCommandWithInvalidJson(): array { } EOT, ], + [ + '"11bd3487e-71d1-4fca-a2d9-5f969b3d35c1"', + ], ]; }