1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-09 16:32:39 +01:00

Fix PhutilUTF8TestCase::testUTF8Convert for PHP 8

Summary:
In PHP 8 passing an invalid encoding to mb_convert_encoding raises a
ValueError (which extends Error not Exception), so fix the test to also
catch Throwable (but leave the explicit Exception case for PHP 5, which
lacks Throwable).

Test Plan: Ran arc unit --everything

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21501
This commit is contained in:
Jessica Clarke 2021-01-11 04:49:54 +00:00 committed by jrtc27
parent 687cb41ace
commit 9589fd1866

View file

@ -498,6 +498,8 @@ final class PhutilUTF8TestCase extends PhutilTestCase {
phutil_utf8_convert('xyz', 'moon language', 'UTF-8');
} catch (Exception $ex) {
$caught = $ex;
} catch (Throwable $ex) {
$caught = $ex;
}
$this->assertTrue((bool)$caught, pht('Conversion with bogus encoding.'));