1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +01:00

Fix some test suite stragglers with PHP 8.1 compatibility

Summary: Ref T13588. This allows "arc unit --everything" to more or less run cleanly on PHP 8.1.

Test Plan: Ran "arc unit --everything".

Maniphest Tasks: T13588

Differential Revision: https://secure.phabricator.com/D21821
This commit is contained in:
epriestley 2022-05-12 15:28:58 -07:00
parent 7693a711a7
commit ee6e2a396f
5 changed files with 10 additions and 6 deletions

View file

@ -184,14 +184,14 @@ final class PhutilICSWriter extends Phobject {
} }
$name = $event->getName(); $name = $event->getName();
if (strlen($name)) { if (phutil_nonempty_string($name)) {
$properties[] = $this->newTextProperty( $properties[] = $this->newTextProperty(
'SUMMARY', 'SUMMARY',
$name); $name);
} }
$description = $event->getDescription(); $description = $event->getDescription();
if (strlen($description)) { if (phutil_nonempty_string($description)) {
$properties[] = $this->newTextProperty( $properties[] = $this->newTextProperty(
'DESCRIPTION', 'DESCRIPTION',
$description); $description);

View file

@ -45,6 +45,10 @@ final class PhabricatorFileStorageFormatTestCase extends PhabricatorTestCase {
} }
public function testAES256Storage() { public function testAES256Storage() {
if (!function_exists('openssl_encrypt')) {
$this->assertSkipped(pht('No OpenSSL extension available.'));
}
$engine = new PhabricatorTestStorageEngine(); $engine = new PhabricatorTestStorageEngine();
$key_name = 'test.abcd'; $key_name = 'test.abcd';

View file

@ -164,7 +164,7 @@ final class NuanceGitHubRawEvent extends Phobject {
$raw = $this->raw; $raw = $this->raw;
$full = idxv($raw, array('repo', 'name')); $full = idxv($raw, array('repo', 'name'));
if (strlen($full)) { if (phutil_nonempty_string($full)) {
return $full; return $full;
} }

View file

@ -446,7 +446,7 @@ final class PhutilRemarkupListBlockRule extends PhutilRemarkupBlockRule {
} }
$start_attr = null; $start_attr = null;
if (ctype_digit($starts_at) && $starts_at > 1) { if (ctype_digit(phutil_string_cast($starts_at)) && $starts_at > 1) {
$start_attr = hsprintf(' start="%d"', $starts_at); $start_attr = hsprintf(' start="%d"', $starts_at);
} }

View file

@ -46,7 +46,7 @@ final class PhutilRemarkupDocumentLinkRule extends PhutilRemarkupRule {
$is_anchor = false; $is_anchor = false;
if (strncmp($link, '/', 1) == 0) { if (strncmp($link, '/', 1) == 0) {
$base = $engine->getConfig('uri.base'); $base = phutil_string_cast($engine->getConfig('uri.base'));
$base = rtrim($base, '/'); $base = rtrim($base, '/');
$link = $base.$link; $link = $base.$link;
} else if (strncmp($link, '#', 1) == 0) { } else if (strncmp($link, '#', 1) == 0) {
@ -134,7 +134,7 @@ final class PhutilRemarkupDocumentLinkRule extends PhutilRemarkupRule {
public function markupDocumentLink(array $matches) { public function markupDocumentLink(array $matches) {
$uri = trim($matches[1]); $uri = trim($matches[1]);
$name = trim(idx($matches, 2)); $name = trim(idx($matches, 2, ''));
if (!$this->isFlatText($uri)) { if (!$this->isFlatText($uri)) {
return $matches[0]; return $matches[0];