Merge remote-tracking branch 'upstream/master'
* upstream/master: Correct Aphlict websocket URI construction after PHP8 compatibility changes Addressing PHP8 incompatibilities - Miscellaneous Addressing PHP8 incompatibilities - Conduit Addressing some PHP8 incompatibilities - Dashboard Addressing some PHP8 incompatibilities - Misc. Applications Updates for Mercurial's HTTP protocol Addressing some PHP 8 incompatibilities - Remarkup Addressing some PHP8 incompatibilities - Diffusion & Differential Addressing some PHP8 incompatibilities - ProfileMenuItem Addressing some PHP 8 incompatibilities Fix support for pk-zip compressed figlet font files Update Figlet implementation to be PHP8 compatible Fix file PHID extraction in Pholio
This commit is contained in:
commit
cc8a27af16
|
@ -10,25 +10,25 @@ insert_final_newline = true
|
|||
max_line_length = 80
|
||||
|
||||
[.arclint]
|
||||
max_line_length =
|
||||
max_line_length = unset
|
||||
|
||||
[resources/sql/**.sql]
|
||||
max_line_length =
|
||||
max_line_length = unset
|
||||
|
||||
[scripts/install/install_*.sh]
|
||||
max_line_length =
|
||||
max_line_length = unset
|
||||
|
||||
[src/applications/differential/parser/__tests__/data/*.diff]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[src/applications/differential/parser/__tests__/messages/long-title.txt]
|
||||
max_line_length =
|
||||
max_line_length = unset
|
||||
|
||||
[src/applications/diffusion/ssh/__tests__/hgwiredata/*.txt]
|
||||
max_line_length =
|
||||
max_line_length = unset
|
||||
|
||||
[externals/**]
|
||||
indent_style =
|
||||
indent_size =
|
||||
indent_style = unset
|
||||
indent_size = unset
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -36,6 +36,8 @@
|
|||
|
||||
# NPM local packages
|
||||
/support/aphlict/server/node_modules/
|
||||
/support/aphlict/server/package.json
|
||||
/support/aphlict/server/package-lock.json
|
||||
|
||||
# Places for users to add custom resources.
|
||||
/resources/cows/custom/*
|
||||
|
|
26
externals/pear-figlet/Text/Figlet.php
vendored
26
externals/pear-figlet/Text/Figlet.php
vendored
|
@ -140,20 +140,22 @@ class Text_Figlet
|
|||
if (!$compressed) {
|
||||
/* ZIPed font */
|
||||
if (fread($fp, 2) == 'PK') {
|
||||
if (!function_exists('zip_open')) {
|
||||
return self::raiseError('Cannot load ZIP compressed fonts since'
|
||||
. ' ZIP PHP extension is not available.',
|
||||
5);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
if (!($fp = zip_open($filename))) {
|
||||
return self::raiseError('Cannot open figlet font file ' . $filename, 2);
|
||||
$zip = new ZipArchive();
|
||||
$open_flag = 0;
|
||||
// The RDONLY flag was only introduced in 7.4.3.
|
||||
if (defined('ZipArchive::RDONLY')) {
|
||||
$open_flag = ZipArchive::RDONLY;
|
||||
}
|
||||
$open_result = $zip->open($filename, $open_flag);
|
||||
if ($open_result !== true) {
|
||||
return self::raiseError('Cannot open figlet font file ' .
|
||||
$filename . ', got error: ' . $open_result, 2);
|
||||
}
|
||||
|
||||
$name = zip_entry_name(zip_read($fp));
|
||||
zip_close($fp);
|
||||
$name = $zip->getNameIndex(0);
|
||||
$zip->close();
|
||||
|
||||
if (!($fp = fopen('zip://' . realpath($filename) . '#' . $name, 'rb'))) {
|
||||
return self::raiseError('Cannot open figlet font file ' . $filename, 2);
|
||||
|
@ -231,7 +233,7 @@ class Text_Figlet
|
|||
$i = hexdec(substr($i, 2));
|
||||
} else {
|
||||
// If octal
|
||||
if ($i{0} === '0' && $i !== '0' || substr($i, 0, 2) == '-0') {
|
||||
if ($i[0] === '0' && $i !== '0' || substr($i, 0, 2) == '-0') {
|
||||
$i = octdec($i);
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +276,7 @@ class Text_Figlet
|
|||
$lt = hexdec(substr($str, $i+2, 4));
|
||||
$i += 5;
|
||||
} else {
|
||||
$lt = ord($str{$i});
|
||||
$lt = ord($str[$i]);
|
||||
}
|
||||
|
||||
$hb = preg_quote($this->hardblank, '/');
|
||||
|
|
|
@ -119,7 +119,7 @@ if ($is_svnrevprop) {
|
|||
exit($err);
|
||||
} else if ($repository->isGit() || $repository->isHg()) {
|
||||
$username = getenv(DiffusionCommitHookEngine::ENV_USER);
|
||||
if (!strlen($username)) {
|
||||
if ($username === null || !strlen($username)) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'No Direct Pushes: You are pushing directly to a hosted repository. '.
|
||||
|
@ -181,17 +181,17 @@ $engine->setStdin($stdin);
|
|||
$engine->setOriginalArgv(array_slice($argv, 2));
|
||||
|
||||
$remote_address = getenv(DiffusionCommitHookEngine::ENV_REMOTE_ADDRESS);
|
||||
if (strlen($remote_address)) {
|
||||
if ($remote_address !== false && strlen($remote_address)) {
|
||||
$engine->setRemoteAddress($remote_address);
|
||||
}
|
||||
|
||||
$remote_protocol = getenv(DiffusionCommitHookEngine::ENV_REMOTE_PROTOCOL);
|
||||
if (strlen($remote_protocol)) {
|
||||
if ($remote_protocol !== false && strlen($remote_protocol)) {
|
||||
$engine->setRemoteProtocol($remote_protocol);
|
||||
}
|
||||
|
||||
$request_identifier = getenv(DiffusionCommitHookEngine::ENV_REQUEST);
|
||||
if (strlen($request_identifier)) {
|
||||
if ($request_identifier !== false && strlen($request_identifier)) {
|
||||
$engine->setRequestIdentifier($request_identifier);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ $authstruct_raw = $cache->getKey($authstruct_key);
|
|||
|
||||
$authstruct = null;
|
||||
|
||||
if (strlen($authstruct_raw)) {
|
||||
if ($authstruct_raw !== null && strlen($authstruct_raw)) {
|
||||
try {
|
||||
$authstruct = phutil_json_decode($authstruct_raw);
|
||||
} catch (Exception $ex) {
|
||||
|
@ -135,7 +135,7 @@ foreach ($authstruct['keys'] as $key_struct) {
|
|||
|
||||
$cmd = csprintf('%s %Ls', $bin, $key_argv);
|
||||
|
||||
if (strlen($instance)) {
|
||||
if ($instance !== null && strlen($instance)) {
|
||||
$cmd = csprintf('PHABRICATOR_INSTANCE=%s %C', $instance, $cmd);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ try {
|
|||
'--phabricator-ssh-device',
|
||||
$user_name,
|
||||
$device_name));
|
||||
} else if (strlen($user_name)) {
|
||||
} else if ($user_name !== null && strlen($user_name)) {
|
||||
$user = id(new PhabricatorPeopleQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->withUsernames(array($user_name))
|
||||
|
@ -117,7 +117,7 @@ try {
|
|||
|
||||
id(new PhabricatorAuthSessionEngine())
|
||||
->willServeRequestForUser($user);
|
||||
} else if (strlen($device_name)) {
|
||||
} else if ($device_name !== null && strlen($device_name)) {
|
||||
if (!$remote_address) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
|
|
|
@ -66,7 +66,7 @@ final class AphrontRequest extends Phobject {
|
|||
}
|
||||
|
||||
public static function parseURILineRange($range, $limit) {
|
||||
if (!strlen($range)) {
|
||||
if ($range === null || !strlen($range)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -448,11 +448,10 @@ final class AphrontRequest extends Phobject {
|
|||
}
|
||||
|
||||
private function getPrefixedCookieName($name) {
|
||||
if (strlen($this->cookiePrefix)) {
|
||||
if ($this->cookiePrefix !== null && strlen($this->cookiePrefix)) {
|
||||
return $this->cookiePrefix.'_'.$name;
|
||||
} else {
|
||||
return $name;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
public function getCookie($name, $default = null) {
|
||||
|
@ -499,7 +498,7 @@ final class AphrontRequest extends Phobject {
|
|||
// domain is. This makes setup easier, and we'll tell administrators to
|
||||
// configure a base domain during the setup process.
|
||||
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
|
||||
if (!strlen($base_uri)) {
|
||||
if ($base_uri === null || !strlen($base_uri)) {
|
||||
return new PhutilURI('http://'.$host.'/');
|
||||
}
|
||||
|
||||
|
@ -956,7 +955,7 @@ final class AphrontRequest extends Phobject {
|
|||
$submit_cookie = PhabricatorCookies::COOKIE_SUBMIT;
|
||||
|
||||
$submit_key = $this->getCookie($submit_cookie);
|
||||
if (strlen($submit_key)) {
|
||||
if ($submit_key !== null && strlen($submit_key)) {
|
||||
$this->clearCookie($submit_cookie);
|
||||
$this->submitKey = $submit_key;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ final class AphrontAjaxResponse extends AphrontResponse {
|
|||
if ($viewer) {
|
||||
$postprocessor_key = $viewer->getUserSetting(
|
||||
PhabricatorAccessibilitySetting::SETTINGKEY);
|
||||
if (strlen($postprocessor_key)) {
|
||||
if ($postprocessor_key !== null && strlen($postprocessor_key)) {
|
||||
$response->setPostprocessorKey($postprocessor_key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ final class AphrontFileResponse extends AphrontResponse {
|
|||
}
|
||||
|
||||
public function setDownload($download) {
|
||||
if (!strlen($download)) {
|
||||
if ($download === null || !strlen($download)) {
|
||||
$download = 'untitled';
|
||||
}
|
||||
$this->download = $download;
|
||||
|
@ -113,7 +113,8 @@ final class AphrontFileResponse extends AphrontResponse {
|
|||
$headers[] = array('Content-Length', $content_len);
|
||||
}
|
||||
|
||||
if (strlen($this->getDownload())) {
|
||||
$download = $this->getDownload();
|
||||
if ($download !== null && strlen($download)) {
|
||||
$headers[] = array('X-Download-Options', 'noopen');
|
||||
|
||||
$filename = $this->getDownload();
|
||||
|
@ -150,7 +151,7 @@ final class AphrontFileResponse extends AphrontResponse {
|
|||
$begin = (int)$matches[1];
|
||||
|
||||
// The "Range" may be "200-299" or "200-", meaning "until end of file".
|
||||
if (strlen($matches[2])) {
|
||||
if ($matches[2] !== null && strlen($matches[2])) {
|
||||
$range_end = (int)$matches[2];
|
||||
$end = $range_end + 1;
|
||||
} else {
|
||||
|
|
|
@ -21,7 +21,7 @@ final class AphrontWebpageResponse extends AphrontHTMLResponse {
|
|||
|
||||
public function buildResponseString() {
|
||||
$unexpected_output = $this->getUnexpectedOutput();
|
||||
if (strlen($unexpected_output)) {
|
||||
if ($unexpected_output !== null && strlen($unexpected_output)) {
|
||||
$style = array(
|
||||
'background: linear-gradient(180deg, #eeddff, #ddbbff);',
|
||||
'white-space: pre-wrap;',
|
||||
|
|
|
@ -16,7 +16,7 @@ final class AlmanacPropertyEditController
|
|||
$cancel_uri = $object->getURI();
|
||||
$property_key = $request->getStr('key');
|
||||
|
||||
if (!strlen($property_key)) {
|
||||
if (!phutil_nonempty_string($property_key)) {
|
||||
return $this->buildPropertyKeyResponse($cancel_uri, null);
|
||||
} else {
|
||||
$error = null;
|
||||
|
|
|
@ -58,7 +58,7 @@ final class AlmanacKeys extends Phobject {
|
|||
|
||||
public static function getClusterSSHUser() {
|
||||
$username = PhabricatorEnv::getEnvConfig('diffusion.ssh-user');
|
||||
if (strlen($username)) {
|
||||
if ($username !== null && strlen($username)) {
|
||||
return $username;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ final class PhabricatorCookies extends Phobject {
|
|||
// temporary and clearing it when users log out.
|
||||
|
||||
$value = $request->getCookie(self::COOKIE_CLIENTID);
|
||||
if (!strlen($value)) {
|
||||
if ($value === null || !strlen($value)) {
|
||||
$request->setTemporaryCookie(
|
||||
self::COOKIE_CLIENTID,
|
||||
Filesystem::readRandomCharacters(16));
|
||||
|
@ -164,7 +164,7 @@ final class PhabricatorCookies extends Phobject {
|
|||
// Old cookies look like: /uri
|
||||
// New cookies look like: timestamp,/uri
|
||||
|
||||
if (!strlen($cookie)) {
|
||||
if (!phutil_nonempty_string($cookie)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ abstract class PhabricatorAuthController extends PhabricatorController {
|
|||
$viewer,
|
||||
PhabricatorAuthLoginMessageType::MESSAGEKEY);
|
||||
|
||||
if (!strlen($text)) {
|
||||
if ($text === null || !strlen($text)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ final class PhabricatorAuthRegisterController
|
|||
$invite = $this->loadInvite();
|
||||
|
||||
$is_setup = false;
|
||||
if (strlen($account_key)) {
|
||||
if ($account_key !== null && strlen($account_key)) {
|
||||
$result = $this->loadAccountForRegistrationOrLinking($account_key);
|
||||
list($account, $provider, $response) = $result;
|
||||
$is_default = false;
|
||||
|
@ -251,9 +251,9 @@ final class PhabricatorAuthRegisterController
|
|||
|
||||
$require_real_name = PhabricatorEnv::getEnvConfig('user.require-real-name');
|
||||
|
||||
$e_username = strlen($value_username) ? null : true;
|
||||
$e_username = phutil_nonempty_string($value_username) ? null : true;
|
||||
$e_realname = $require_real_name ? true : null;
|
||||
$e_email = strlen($value_email) ? null : true;
|
||||
$e_email = phutil_nonempty_string($value_email) ? null : true;
|
||||
$e_password = true;
|
||||
$e_captcha = true;
|
||||
|
||||
|
@ -295,7 +295,7 @@ final class PhabricatorAuthRegisterController
|
|||
|
||||
if ($can_edit_username) {
|
||||
$value_username = $request->getStr('username');
|
||||
if (!strlen($value_username)) {
|
||||
if (!phutil_nonempty_string($value_username)) {
|
||||
$e_username = pht('Required');
|
||||
$errors[] = pht('Username is required.');
|
||||
} else if (!PhabricatorUser::validateUsername($value_username)) {
|
||||
|
@ -330,7 +330,7 @@ final class PhabricatorAuthRegisterController
|
|||
|
||||
if ($can_edit_email) {
|
||||
$value_email = $request->getStr('email');
|
||||
if (!strlen($value_email)) {
|
||||
if (!phutil_nonempty_string($value_email)) {
|
||||
$e_email = pht('Required');
|
||||
$errors[] = pht('Email is required.');
|
||||
} else if (!PhabricatorUserEmail::isValidAddress($value_email)) {
|
||||
|
@ -350,7 +350,7 @@ final class PhabricatorAuthRegisterController
|
|||
|
||||
if ($can_edit_realname) {
|
||||
$value_realname = $request->getStr('realName');
|
||||
if (!strlen($value_realname) && $require_real_name) {
|
||||
if (!phutil_nonempty_string($value_realname) && $require_real_name) {
|
||||
$e_realname = pht('Required');
|
||||
$errors[] = pht('Real name is required.');
|
||||
} else {
|
||||
|
|
|
@ -54,10 +54,10 @@ final class PhabricatorAuthSSHKeyEditController
|
|||
$cancel_uri);
|
||||
|
||||
$v_name = $key->getName();
|
||||
$e_name = strlen($v_name) ? null : true;
|
||||
$e_name = $v_name !== null && strlen($v_name) ? null : true;
|
||||
|
||||
$v_key = $key->getEntireKey();
|
||||
$e_key = strlen($v_key) ? null : true;
|
||||
$e_key = $v_key !== null && strlen($v_key) ? null : true;
|
||||
|
||||
$validation_exception = null;
|
||||
if ($request->isFormPost()) {
|
||||
|
|
|
@ -40,7 +40,7 @@ final class PhabricatorAuthSetExternalController
|
|||
$text = PhabricatorAuthMessage::loadMessageText(
|
||||
$viewer,
|
||||
PhabricatorAuthLinkMessageType::MESSAGEKEY);
|
||||
if (!strlen($text)) {
|
||||
if (!phutil_nonempty_string($text)) {
|
||||
$text = pht(
|
||||
'You can link your %s account to an external account to '.
|
||||
'allow you to log in more easily in the future. To continue, choose '.
|
||||
|
|
|
@ -31,7 +31,7 @@ final class PhabricatorAuthStartController
|
|||
$session_token = $request->getCookie(PhabricatorCookies::COOKIE_SESSION);
|
||||
$did_clear = $request->getStr('cleared');
|
||||
|
||||
if (strlen($session_token)) {
|
||||
if ($session_token !== null && strlen($session_token)) {
|
||||
$kind = PhabricatorAuthSessionEngine::getSessionKindFromToken(
|
||||
$session_token);
|
||||
switch ($kind) {
|
||||
|
@ -98,7 +98,7 @@ final class PhabricatorAuthStartController
|
|||
}
|
||||
|
||||
$next_uri = $request->getStr('next');
|
||||
if (!strlen($next_uri)) {
|
||||
if (phutil_nonempty_string($next_uri)) {
|
||||
if ($this->getDelegatingController()) {
|
||||
// Only set a next URI from the request path if this controller was
|
||||
// delegated to, which happens when a user tries to view a page which
|
||||
|
@ -112,7 +112,7 @@ final class PhabricatorAuthStartController
|
|||
}
|
||||
|
||||
if (!$request->isFormPost()) {
|
||||
if (strlen($next_uri)) {
|
||||
if (phutil_nonempty_string($next_uri)) {
|
||||
PhabricatorCookies::setNextURICookie($request, $next_uri);
|
||||
}
|
||||
PhabricatorCookies::setClientIDCookie($request);
|
||||
|
@ -226,7 +226,7 @@ final class PhabricatorAuthStartController
|
|||
|
||||
$via_header = AphrontRequest::getViaHeaderName();
|
||||
$via_uri = AphrontRequest::getHTTPHeader($via_header);
|
||||
if (strlen($via_uri)) {
|
||||
if ($via_uri !== null && strlen($via_uri)) {
|
||||
PhabricatorCookies::setNextURICookie($request, $via_uri, $force = true);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ final class PhabricatorAuthFactorProviderViewController
|
|||
|
||||
|
||||
$custom_enroll = $provider->getEnrollMessage();
|
||||
if (strlen($custom_enroll)) {
|
||||
if ($custom_enroll !== null && strlen($custom_enroll)) {
|
||||
$view->addSectionHeader(
|
||||
pht('Custom Enroll Message'),
|
||||
PHUIPropertyListView::ICON_SUMMARY);
|
||||
|
|
|
@ -414,7 +414,7 @@ abstract class PhabricatorAuthFactor extends Phobject {
|
|||
$sync_token = null;
|
||||
|
||||
$sync_key = $request->getStr($this->getMFASyncTokenFormKey());
|
||||
if (strlen($sync_key)) {
|
||||
if (phutil_nonempty_string($sync_key)) {
|
||||
$sync_key_digest = PhabricatorHash::digestWithNamedKey(
|
||||
$sync_key,
|
||||
PhabricatorAuthMFASyncTemporaryTokenType::DIGEST_KEY);
|
||||
|
|
|
@ -4,7 +4,7 @@ final class PhabricatorAuthPasswordException
|
|||
extends Exception {
|
||||
|
||||
private $passwordError;
|
||||
private $confirmErorr;
|
||||
private $confirmError;
|
||||
|
||||
public function __construct(
|
||||
$message,
|
||||
|
|
|
@ -57,6 +57,9 @@ final class PhabricatorAuthChallenge
|
|||
assert_instances_of($challenges, __CLASS__);
|
||||
|
||||
$token_list = $request->getStr(self::HTTPKEY);
|
||||
if ($token_list === null) {
|
||||
return;
|
||||
}
|
||||
$token_list = explode(' ', $token_list);
|
||||
|
||||
$token_map = array();
|
||||
|
|
|
@ -74,7 +74,7 @@ abstract class PhabricatorController extends AphrontController {
|
|||
$session_engine = new PhabricatorAuthSessionEngine();
|
||||
|
||||
$phsid = $request->getCookie(PhabricatorCookies::COOKIE_SESSION);
|
||||
if (strlen($phsid)) {
|
||||
if ($phsid !== null && strlen($phsid)) {
|
||||
$session_user = $session_engine->loadUserForSession(
|
||||
PhabricatorAuthSession::TYPE_WEB,
|
||||
$phsid);
|
||||
|
|
|
@ -113,7 +113,7 @@ abstract class CelerityResourceController extends PhabricatorController {
|
|||
|
||||
$range = AphrontRequest::getHTTPHeader('Range');
|
||||
|
||||
if (strlen($range)) {
|
||||
if ($range !== null && strlen($range)) {
|
||||
$response->setContentLength(strlen($data));
|
||||
|
||||
list($range_begin, $range_end) = $response->parseHTTPRange($range);
|
||||
|
|
|
@ -290,7 +290,7 @@ final class PhabricatorConduitAPIController
|
|||
}
|
||||
|
||||
$token_string = idx($metadata, 'token');
|
||||
if (strlen($token_string)) {
|
||||
if ($token_string !== null && strlen($token_string)) {
|
||||
|
||||
if (strlen($token_string) != 32) {
|
||||
return array(
|
||||
|
@ -683,7 +683,7 @@ final class PhabricatorConduitAPIController
|
|||
// Otherwise, look for a single parameter called 'params' which has the
|
||||
// entire param dictionary JSON encoded.
|
||||
$params_json = $request->getStr('params');
|
||||
if (strlen($params_json)) {
|
||||
if (phutil_nonempty_string($params_json)) {
|
||||
$params = null;
|
||||
try {
|
||||
$params = phutil_json_decode($params_json);
|
||||
|
|
|
@ -39,7 +39,7 @@ final class PhabricatorConduitSearchEngine
|
|||
$query->withIsInternal(false);
|
||||
|
||||
$contains = $saved->getParameter('nameContains');
|
||||
if (strlen($contains)) {
|
||||
if ($contains !== null && strlen($contains)) {
|
||||
$query->withNameContains($contains);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ final class PhabricatorBaseURISetupCheck extends PhabricatorSetupCheck {
|
|||
|
||||
$host_header = AphrontRequest::getHTTPHeader('Host');
|
||||
if (strpos($host_header, '.') === false) {
|
||||
if (!strlen(trim($host_header))) {
|
||||
if ($host_header === null || !strlen(trim($host_header))) {
|
||||
$name = pht('No "Host" Header');
|
||||
$summary = pht('No "Host" header present in request.');
|
||||
$message = pht(
|
||||
|
|
|
@ -53,7 +53,7 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
|
|||
}
|
||||
|
||||
$expect_user = PhabricatorEnv::getEnvConfig('phd.user');
|
||||
if (strlen($expect_user)) {
|
||||
if ($expect_user !== null && strlen($expect_user)) {
|
||||
|
||||
try {
|
||||
$all_daemons = id(new PhabricatorDaemonLogQuery())
|
||||
|
|
|
@ -124,7 +124,7 @@ final class PhabricatorPHPPreflightSetupCheck extends PhabricatorSetupCheck {
|
|||
}
|
||||
|
||||
$open_basedir = ini_get('open_basedir');
|
||||
if (strlen($open_basedir)) {
|
||||
if ($open_basedir !== null && strlen($open_basedir)) {
|
||||
// If `open_basedir` is set, just fatal. It's technically possible for
|
||||
// us to run with certain values of `open_basedir`, but: we can only
|
||||
// raise fatal errors from preflight steps, so we'd have to do this check
|
||||
|
|
|
@ -122,7 +122,7 @@ abstract class PhabricatorSetupCheck extends Phobject {
|
|||
$db_cache = new PhabricatorKeyValueDatabaseCache();
|
||||
try {
|
||||
$value = $db_cache->getKey('phabricator.setup.issue-keys');
|
||||
if (!strlen($value)) {
|
||||
if ($value === null || !strlen($value)) {
|
||||
return null;
|
||||
}
|
||||
return phutil_json_decode($value);
|
||||
|
|
|
@ -151,19 +151,19 @@ final class PhabricatorStorageSetupCheck extends PhabricatorSetupCheck {
|
|||
|
||||
$how_many = 0;
|
||||
|
||||
if (strlen($access_key)) {
|
||||
if ($access_key !== null && strlen($access_key)) {
|
||||
$how_many++;
|
||||
}
|
||||
|
||||
if (strlen($secret_key)) {
|
||||
if ($secret_key !== null && strlen($secret_key)) {
|
||||
$how_many++;
|
||||
}
|
||||
|
||||
if (strlen($region)) {
|
||||
if ($region !== null && strlen($region)) {
|
||||
$how_many++;
|
||||
}
|
||||
|
||||
if (strlen($endpoint)) {
|
||||
if ($endpoint !== null && strlen($endpoint)) {
|
||||
$how_many++;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ final class PhabricatorWebServerSetupCheck extends PhabricatorSetupCheck {
|
|||
}
|
||||
|
||||
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
|
||||
if (!strlen($base_uri)) {
|
||||
if ($base_uri === null || !strlen($base_uri)) {
|
||||
// If `phabricator.base-uri` is not set then we can't really do
|
||||
// anything.
|
||||
return;
|
||||
|
|
|
@ -85,14 +85,14 @@ final class PhabricatorConfigConsoleController
|
|||
$rows = array();
|
||||
foreach ($versions as $name => $info) {
|
||||
$branchpoint = $info['branchpoint'];
|
||||
if (strlen($branchpoint)) {
|
||||
if ($branchpoint !== null && strlen($branchpoint)) {
|
||||
$branchpoint = substr($branchpoint, 0, 12);
|
||||
} else {
|
||||
$branchpoint = null;
|
||||
}
|
||||
|
||||
$version = $info['hash'];
|
||||
if (strlen($version)) {
|
||||
if ($version !== null && strlen($version)) {
|
||||
$version = substr($version, 0, 12);
|
||||
} else {
|
||||
$version = pht('Unknown');
|
||||
|
|
|
@ -9,7 +9,7 @@ final class PhabricatorConfigModuleController
|
|||
|
||||
$all_modules = PhabricatorConfigModule::getAllModules();
|
||||
|
||||
if (!strlen($key)) {
|
||||
if ($key === null || !strlen($key)) {
|
||||
$key = head_key($all_modules);
|
||||
}
|
||||
|
||||
|
|
|
@ -837,7 +837,7 @@ final class PhabricatorConfigDatabaseStatusController
|
|||
|
||||
$parts = array();
|
||||
foreach ($properties as $key => $property) {
|
||||
if (!strlen($property)) {
|
||||
if ($property === null || !strlen($property)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ final class PhabricatorConfigSettingsListController
|
|||
$viewer = $request->getViewer();
|
||||
|
||||
$filter = $request->getURIData('filter');
|
||||
if (!strlen($filter)) {
|
||||
if ($filter === null || !strlen($filter)) {
|
||||
$filter = 'settings';
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,8 @@ final class ConpherenceThreadQuery
|
|||
}
|
||||
|
||||
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
||||
if ($this->participantPHIDs !== null || strlen($this->fulltext)) {
|
||||
if ($this->participantPHIDs !== null
|
||||
|| ($this->fulltext !== null && strlen($this->fulltext))) {
|
||||
return qsprintf($conn_r, 'GROUP BY thread.id');
|
||||
} else {
|
||||
return $this->buildApplicationSearchGroupClause($conn_r);
|
||||
|
@ -152,7 +153,7 @@ final class ConpherenceThreadQuery
|
|||
id(new ConpherenceParticipant())->getTableName());
|
||||
}
|
||||
|
||||
if (strlen($this->fulltext)) {
|
||||
if ($this->fulltext !== null && strlen($this->fulltext)) {
|
||||
$joins[] = qsprintf(
|
||||
$conn,
|
||||
'JOIN %T idx ON idx.threadPHID = thread.phid',
|
||||
|
@ -234,7 +235,7 @@ final class ConpherenceThreadQuery
|
|||
$this->participantPHIDs);
|
||||
}
|
||||
|
||||
if (strlen($this->fulltext)) {
|
||||
if ($this->fulltext !== null && strlen($this->fulltext)) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)',
|
||||
|
|
|
@ -106,7 +106,7 @@ final class ConpherenceThreadSearchEngine
|
|||
$engines = array();
|
||||
|
||||
$fulltext = $query->getParameter('fulltext');
|
||||
if (strlen($fulltext) && $conpherences) {
|
||||
if ($fulltext !== null && strlen($fulltext) && $conpherences) {
|
||||
$context = $this->loadContextMessages($conpherences, $fulltext);
|
||||
|
||||
$author_phids = array();
|
||||
|
@ -151,7 +151,7 @@ final class ConpherenceThreadSearchEngine
|
|||
$icon = id(new PHUIIconView())
|
||||
->setIcon($icon_name);
|
||||
|
||||
if (!strlen($fulltext)) {
|
||||
if ($fulltext === null || !strlen($fulltext)) {
|
||||
$item = id(new PHUIObjectItemView())
|
||||
->setObjectName($conpherence->getMonogram())
|
||||
->setHeader($title)
|
||||
|
|
|
@ -26,7 +26,7 @@ final class DarkConsoleController extends PhabricatorController {
|
|||
}
|
||||
|
||||
$visible = $request->getStr('visible');
|
||||
if (strlen($visible)) {
|
||||
if (phutil_nonempty_string($visible)) {
|
||||
$this->writeDarkConsoleSetting(
|
||||
PhabricatorDarkConsoleVisibleSetting::SETTINGKEY,
|
||||
(int)$visible);
|
||||
|
@ -34,7 +34,7 @@ final class DarkConsoleController extends PhabricatorController {
|
|||
}
|
||||
|
||||
$tab = $request->getStr('tab');
|
||||
if (strlen($tab)) {
|
||||
if (phutil_nonempty_string($tab)) {
|
||||
$this->writeDarkConsoleSetting(
|
||||
PhabricatorDarkConsoleTabSetting::SETTINGKEY,
|
||||
$tab);
|
||||
|
|
|
@ -114,6 +114,9 @@ final class DarkConsoleCore extends Phobject {
|
|||
* need to convert it to UTF-8.
|
||||
*/
|
||||
private function sanitizeForJSON($data) {
|
||||
if ($data === null) {
|
||||
return '<null>';
|
||||
}
|
||||
if (is_object($data)) {
|
||||
return '<object:'.get_class($data).'>';
|
||||
} else if (is_array($data)) {
|
||||
|
|
|
@ -32,7 +32,7 @@ final class PhabricatorDashboardAdjustController
|
|||
|
||||
$panel_ref = null;
|
||||
$panel_key = $request->getStr('panelKey');
|
||||
if (strlen($panel_key)) {
|
||||
if (phutil_nonempty_string($panel_key)) {
|
||||
$panel_ref = $ref_list->getPanelRef($panel_key);
|
||||
if (!$panel_ref) {
|
||||
return new Aphront404Response();
|
||||
|
@ -42,7 +42,7 @@ final class PhabricatorDashboardAdjustController
|
|||
}
|
||||
|
||||
$column_key = $request->getStr('columnKey');
|
||||
if (strlen($column_key)) {
|
||||
if (phutil_nonempty_string($column_key)) {
|
||||
$columns = $ref_list->getColumns();
|
||||
if (!isset($columns[$column_key])) {
|
||||
return new Aphront404Response();
|
||||
|
@ -52,7 +52,7 @@ final class PhabricatorDashboardAdjustController
|
|||
|
||||
$after_ref = null;
|
||||
$after_key = $request->getStr('afterKey');
|
||||
if (strlen($after_key)) {
|
||||
if (phutil_nonempty_string($after_key)) {
|
||||
$after_ref = $ref_list->getPanelRef($after_key);
|
||||
if (!$after_ref) {
|
||||
return new Aphront404Response();
|
||||
|
|
|
@ -15,7 +15,7 @@ final class PhabricatorDashboardPanelEditController
|
|||
// editing.
|
||||
|
||||
$context_phid = $request->getStr('contextPHID');
|
||||
if (strlen($context_phid)) {
|
||||
if (phutil_nonempty_string($context_phid)) {
|
||||
$context = id(new PhabricatorObjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($context_phid))
|
||||
|
|
|
@ -41,12 +41,12 @@ final class PhabricatorDashboardPanelTabsController
|
|||
|
||||
$op = $request->getURIData('op');
|
||||
$after = $request->getStr('after');
|
||||
if (!strlen($after)) {
|
||||
if (!phutil_nonempty_string($after)) {
|
||||
$after = null;
|
||||
}
|
||||
|
||||
$target = $request->getStr('target');
|
||||
if (!strlen($target)) {
|
||||
if (!phutil_nonempty_string($target)) {
|
||||
$target = null;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ final class PhabricatorDashboardPanelTabsController
|
|||
|
||||
$context_phid = $request->getStr('contextPHID');
|
||||
$context = null;
|
||||
if (strlen($context_phid)) {
|
||||
if (phutil_nonempty_string($context_phid)) {
|
||||
$context = id(new PhabricatorObjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($context_phid))
|
||||
|
|
|
@ -101,7 +101,7 @@ final class PhabricatorDashboardTabsPanelType
|
|||
$subpanel = idx($panels, $panel_id);
|
||||
|
||||
$name = idx($tab_spec, 'name');
|
||||
if (!strlen($name)) {
|
||||
if ($name === null || !strlen($name)) {
|
||||
if ($subpanel) {
|
||||
$name = $subpanel->getName();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ final class PhabricatorDashboardPanelDatasource
|
|||
$query = new PhabricatorDashboardPanelQuery();
|
||||
|
||||
$raw_query = $this->getRawQuery();
|
||||
if (preg_match('/^[wW]\d+\z/', $raw_query)) {
|
||||
if ($raw_query !== null && preg_match('/^[wW]\d+\z/', $raw_query)) {
|
||||
$id = trim($raw_query, 'wW');
|
||||
$id = (int)$id;
|
||||
$query->withIDs(array($id));
|
||||
|
|
|
@ -55,6 +55,9 @@ final class DifferentialCreateDiffConduitAPIMethod
|
|||
protected function execute(ConduitAPIRequest $request) {
|
||||
$viewer = $request->getUser();
|
||||
$change_data = $request->getValue('changes');
|
||||
if ($change_data === null) {
|
||||
throw new Exception(pht('Field "changes" must be non-empty.'));
|
||||
}
|
||||
|
||||
$changes = array();
|
||||
foreach ($change_data as $dict) {
|
||||
|
|
|
@ -26,6 +26,9 @@ final class DifferentialCreateRawDiffConduitAPIMethod
|
|||
protected function execute(ConduitAPIRequest $request) {
|
||||
$viewer = $request->getUser();
|
||||
$raw_diff = $request->getValue('diff');
|
||||
if ($raw_diff === null || !strlen($raw_diff)) {
|
||||
throw new Exception(pht('Field "raw_diff" must be non-empty.'));
|
||||
}
|
||||
|
||||
$repository_phid = $request->getValue('repositoryPHID');
|
||||
if ($repository_phid) {
|
||||
|
|
|
@ -56,7 +56,7 @@ final class DifferentialGetCommitMessageConduitAPIMethod
|
|||
// show "Field:" templates for some fields even if they are empty.
|
||||
$edit_mode = $request->getValue('edit');
|
||||
|
||||
$is_any_edit = (bool)strlen($edit_mode);
|
||||
$is_any_edit = $edit_mode !== null && (bool)strlen($edit_mode);
|
||||
$is_create = ($edit_mode == 'create');
|
||||
|
||||
$field_list = DifferentialCommitMessageField::newEnabledFields($viewer);
|
||||
|
@ -115,7 +115,7 @@ final class DifferentialGetCommitMessageConduitAPIMethod
|
|||
|
||||
$is_title = ($field_key == $key_title);
|
||||
|
||||
if (!strlen($value)) {
|
||||
if ($value === null || !strlen($value)) {
|
||||
if ($is_template) {
|
||||
$commit_message[] = $label.': ';
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ final class DifferentialParseCommitMessageConduitAPIMethod
|
|||
}
|
||||
|
||||
$corpus = $request->getValue('corpus');
|
||||
if ($corpus === null || !strlen($corpus)) {
|
||||
throw new Exception(pht('Field "corpus" must be non-empty.'));
|
||||
}
|
||||
$field_map = $parser->parseFields($corpus);
|
||||
|
||||
$errors = $parser->getErrors();
|
||||
|
|
|
@ -30,9 +30,22 @@ final class DifferentialSetDiffPropertyConduitAPIMethod
|
|||
}
|
||||
|
||||
protected function execute(ConduitAPIRequest $request) {
|
||||
$data = $request->getValue('data');
|
||||
if ($data === null || !strlen($data)) {
|
||||
throw new Exception(pht('Field "data" must be non-empty.'));
|
||||
}
|
||||
|
||||
$diff_id = $request->getValue('diff_id');
|
||||
if ($diff_id === null) {
|
||||
throw new Exception(pht('Field "diff_id" must be non-null.'));
|
||||
}
|
||||
|
||||
$name = $request->getValue('name');
|
||||
$data = json_decode($request->getValue('data'), true);
|
||||
if ($name === null || !strlen($name)) {
|
||||
throw new Exception(pht('Field "name" must be non-empty.'));
|
||||
}
|
||||
|
||||
$data = json_decode($data, true);
|
||||
|
||||
self::updateDiffProperty($diff_id, $name, $data);
|
||||
}
|
||||
|
|
|
@ -39,13 +39,20 @@ final class DifferentialBranchField
|
|||
$branch = $diff->getBranch();
|
||||
$bookmark = $diff->getBookmark();
|
||||
|
||||
if ($branch === null) {
|
||||
$branch = '';
|
||||
}
|
||||
if ($bookmark === null) {
|
||||
$bookmark = '';
|
||||
}
|
||||
|
||||
if (strlen($branch) && strlen($bookmark)) {
|
||||
return pht('%s (bookmark) on %s (branch)', $bookmark, $branch);
|
||||
} else if (strlen($bookmark)) {
|
||||
return pht('%s (bookmark)', $bookmark);
|
||||
} else if (strlen($branch)) {
|
||||
$onto = $diff->loadTargetBranch();
|
||||
if (strlen($onto) && ($onto !== $branch)) {
|
||||
if ($onto !== null && strlen($onto) && ($onto !== $branch)) {
|
||||
return pht(
|
||||
'%s (branched from %s)',
|
||||
$branch,
|
||||
|
|
|
@ -218,7 +218,7 @@ final class DifferentialTransactionEditor
|
|||
|
||||
// No "$", to allow for branches like T123_demo.
|
||||
$match = null;
|
||||
if (preg_match('/^T(\d+)/i', $branch, $match)) {
|
||||
if ($branch !== null && preg_match('/^T(\d+)/i', $branch, $match)) {
|
||||
$task_id = $match[1];
|
||||
$tasks = id(new ManiphestTaskQuery())
|
||||
->setViewer($this->getActor())
|
||||
|
|
|
@ -60,7 +60,7 @@ abstract class DifferentialCommitMessageField
|
|||
}
|
||||
|
||||
public function renderFieldValue($value) {
|
||||
if (!strlen($value)) {
|
||||
if ($value === null || !strlen($value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ final class DifferentialRevisionIDCommitMessageField
|
|||
}
|
||||
|
||||
public function renderFieldValue($value) {
|
||||
if (!strlen($value)) {
|
||||
if ($value === null || !strlen($value)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ final class DifferentialChangeset
|
|||
|
||||
public function getOldStatePathVector() {
|
||||
$path = $this->getOldFile();
|
||||
if (!strlen($path)) {
|
||||
if ($path === null || !strlen($path)) {
|
||||
$path = $this->getFilename();
|
||||
}
|
||||
|
||||
|
|
|
@ -251,6 +251,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
|
|||
$content = phabricator_form(
|
||||
$this->getUser(),
|
||||
array(
|
||||
'method' => 'GET',
|
||||
'action' => '/D'.$revision_id.'#toc',
|
||||
),
|
||||
array(
|
||||
|
|
|
@ -30,7 +30,7 @@ final class DiffusionBranchQueryConduitAPIMethod
|
|||
$repository = $drequest->getRepository();
|
||||
|
||||
$contains = $request->getValue('contains');
|
||||
if (strlen($contains)) {
|
||||
if ($contains !== null && strlen($contains)) {
|
||||
|
||||
// See PHI958 (and, earlier, PHI720). If "patterns" are provided, pass
|
||||
// them to "git branch ..." to let callers test for reachability from
|
||||
|
@ -80,7 +80,7 @@ final class DiffusionBranchQueryConduitAPIMethod
|
|||
->setRepository($repository);
|
||||
|
||||
$contains = $request->getValue('contains');
|
||||
if (strlen($contains)) {
|
||||
if ($contains !== null && strlen($contains)) {
|
||||
$query->withContainsCommit($contains);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
|
|||
$repository = $drequest->getRepository();
|
||||
|
||||
$path = $request->getValue('path');
|
||||
if (!strlen($path) || $path === '/') {
|
||||
if ($path === null || !strlen($path) || $path === '/') {
|
||||
$path = null;
|
||||
}
|
||||
|
||||
|
@ -282,8 +282,13 @@ final class DiffusionBrowseQueryConduitAPIMethod
|
|||
|
||||
$results = array();
|
||||
|
||||
$match_against = trim($path, '/');
|
||||
$match_len = strlen($match_against);
|
||||
if ($path !== null) {
|
||||
$match_against = trim($path, '/');
|
||||
$match_len = strlen($match_against);
|
||||
} else {
|
||||
$match_against = '';
|
||||
$match_len = 0;
|
||||
}
|
||||
|
||||
// For the root, don't trim. For other paths, trim the "/" after we match.
|
||||
// We need this because Mercurial's canonical paths have no leading "/",
|
||||
|
@ -295,7 +300,7 @@ final class DiffusionBrowseQueryConduitAPIMethod
|
|||
if (strncmp($path, $match_against, $match_len)) {
|
||||
continue;
|
||||
}
|
||||
if (!strlen($path)) {
|
||||
if ($path === null || !strlen($path)) {
|
||||
continue;
|
||||
}
|
||||
$remainder = substr($path, $trim_len);
|
||||
|
|
|
@ -45,17 +45,16 @@ final class DiffusionHistoryQueryConduitAPIMethod
|
|||
$repository = $drequest->getRepository();
|
||||
$commit_hash = $request->getValue('commit');
|
||||
$against_hash = $request->getValue('against');
|
||||
|
||||
$path = $request->getValue('path');
|
||||
if (!strlen($path)) {
|
||||
$path = null;
|
||||
}
|
||||
|
||||
$offset = $request->getValue('offset');
|
||||
$limit = $request->getValue('limit');
|
||||
|
||||
if (strlen($against_hash)) {
|
||||
$commit_range = "${against_hash}..${commit_hash}";
|
||||
$path = $request->getValue('path');
|
||||
if ($path === null || !strlen($path)) {
|
||||
$path = null;
|
||||
}
|
||||
|
||||
if ($against_hash !== null && strlen($against_hash)) {
|
||||
$commit_range = "{$against_hash}..{$commit_hash}";
|
||||
} else {
|
||||
$commit_range = $commit_hash;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ final class DiffusionBranchTableController extends DiffusionController {
|
|||
);
|
||||
|
||||
$contains = $drequest->getSymbolicCommit();
|
||||
if (strlen($contains)) {
|
||||
if ($contains !== null && strlen($contains)) {
|
||||
$params['contains'] = $contains;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
// list.
|
||||
|
||||
$grep = $request->getStr('grep');
|
||||
if (strlen($grep)) {
|
||||
if (phutil_nonempty_string($grep)) {
|
||||
return $this->browseSearch();
|
||||
}
|
||||
|
||||
|
@ -290,6 +290,11 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
$header = $this->buildHeaderView($drequest);
|
||||
$header->setHeaderIcon('fa-folder-open');
|
||||
|
||||
$title = '/';
|
||||
if ($drequest->getPath() !== null) {
|
||||
$title = nonempty(basename($drequest->getPath()), '/');
|
||||
}
|
||||
|
||||
$empty_result = null;
|
||||
$browse_panel = null;
|
||||
if (!$results->isValidResults()) {
|
||||
|
@ -303,7 +308,6 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
->setPaths($results->getPaths())
|
||||
->setUser($request->getUser());
|
||||
|
||||
$title = nonempty(basename($drequest->getPath()), '/');
|
||||
$icon = 'fa-folder-open';
|
||||
$browse_header = $this->buildPanelHeaderView($title, $icon);
|
||||
|
||||
|
@ -351,7 +355,7 @@ final class DiffusionBrowseController extends DiffusionController {
|
|||
|
||||
return $this->newPage()
|
||||
->setTitle(array(
|
||||
nonempty(basename($drequest->getPath()), '/'),
|
||||
$title,
|
||||
$repository->getDisplayName(),
|
||||
))
|
||||
->setCrumbs($crumbs)
|
||||
|
|
|
@ -27,8 +27,11 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
|
||||
// If this page is being accessed via "/source/xyz/commit/...", redirect
|
||||
// to the canonical URI.
|
||||
$has_callsign = strlen($request->getURIData('repositoryCallsign'));
|
||||
$has_id = strlen($request->getURIData('repositoryID'));
|
||||
$repo_callsign = $request->getURIData('repositoryCallsign');
|
||||
$has_callsign = $repo_callsign !== null && strlen($repo_callsign);
|
||||
$repo_id = $request->getURIData('repositoryID');
|
||||
$has_id = $repo_id !== null && strlen($repo_id);
|
||||
|
||||
if (!$has_callsign && !$has_id) {
|
||||
$canonical_uri = $repository->getCommitURI($commit_identifier);
|
||||
return id(new AphrontRedirectResponse())
|
||||
|
@ -922,7 +925,7 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
|
||||
private function linkBugtraq($corpus) {
|
||||
$url = PhabricatorEnv::getEnvConfig('bugtraq.url');
|
||||
if (!strlen($url)) {
|
||||
if ($url === null || !strlen($url)) {
|
||||
return $corpus;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,19 +97,19 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
AphrontRequest $request) {
|
||||
|
||||
$short_name = $request->getURIData('repositoryShortName');
|
||||
if (strlen($short_name)) {
|
||||
if ($short_name !== null && strlen($short_name)) {
|
||||
// If the short name ends in ".git", ignore it.
|
||||
$short_name = preg_replace('/\\.git\z/', '', $short_name);
|
||||
return $short_name;
|
||||
}
|
||||
|
||||
$identifier = $request->getURIData('repositoryCallsign');
|
||||
if (strlen($identifier)) {
|
||||
if ($identifier !== null && strlen($identifier)) {
|
||||
return $identifier;
|
||||
}
|
||||
|
||||
$id = $request->getURIData('repositoryID');
|
||||
if (strlen($id)) {
|
||||
if ($id !== null && strlen($id)) {
|
||||
return (int)$id;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,10 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
|
||||
protected function renderPathLinks(DiffusionRequest $drequest, $action) {
|
||||
$path = $drequest->getPath();
|
||||
$path_parts = array_filter(explode('/', trim($path, '/')));
|
||||
$path_parts = array();
|
||||
if ($path !== null && strlen($path)) {
|
||||
$path_parts = array_filter(explode('/', trim($path, '/')));
|
||||
}
|
||||
|
||||
$divider = phutil_tag(
|
||||
'span',
|
||||
|
|
|
@ -50,7 +50,8 @@ final class DiffusionHistoryController extends DiffusionController {
|
|||
// ancestors appropriately, but this would currrently be prohibitively
|
||||
// expensive in the general case.
|
||||
|
||||
$show_graph = !strlen($drequest->getPath());
|
||||
$show_graph = ($drequest->getPath() === null
|
||||
|| !strlen($drequest->getPath()));
|
||||
if ($show_graph) {
|
||||
$history_list
|
||||
->setParents($history_results['parents'])
|
||||
|
@ -98,7 +99,7 @@ final class DiffusionHistoryController extends DiffusionController {
|
|||
$viewer = $this->getViewer();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$no_path = !strlen($drequest->getPath());
|
||||
$no_path = $drequest->getPath() === null || !strlen($drequest->getPath());
|
||||
if ($no_path) {
|
||||
$header_text = pht('History');
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,7 @@ final class DiffusionRepositoryManagePanelsController
|
|||
}
|
||||
|
||||
$selected = $request->getURIData('panel');
|
||||
if (!strlen($selected)) {
|
||||
if ($selected === null || !strlen($selected)) {
|
||||
$selected = head_key($panels);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,11 +183,13 @@ final class DiffusionServeController extends DiffusionController {
|
|||
// won't prompt users who provide a username but no password otherwise.
|
||||
// See T10797 for discussion.
|
||||
|
||||
$have_user = strlen(idx($_SERVER, 'PHP_AUTH_USER'));
|
||||
$have_pass = strlen(idx($_SERVER, 'PHP_AUTH_PW'));
|
||||
$http_user = idx($_SERVER, 'PHP_AUTH_USER');
|
||||
$http_pass = idx($_SERVER, 'PHP_AUTH_PW');
|
||||
$have_user = $http_user !== null && strlen($http_user);
|
||||
$have_pass = $http_pass !== null && strlen($http_pass);
|
||||
if ($have_user && $have_pass) {
|
||||
$username = $_SERVER['PHP_AUTH_USER'];
|
||||
$password = new PhutilOpaqueEnvelope($_SERVER['PHP_AUTH_PW']);
|
||||
$username = $http_user;
|
||||
$password = new PhutilOpaqueEnvelope($http_pass);
|
||||
|
||||
// Try Git LFS auth first since we can usually reject it without doing
|
||||
// any queries, since the username won't match the one we expect or the
|
||||
|
@ -524,9 +526,15 @@ final class DiffusionServeController extends DiffusionController {
|
|||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||
$cmd = $request->getStr('cmd');
|
||||
if ($cmd === null) {
|
||||
return false;
|
||||
}
|
||||
if ($cmd == 'batch') {
|
||||
$cmds = idx($this->getMercurialArguments(), 'cmds');
|
||||
return DiffusionMercurialWireProtocol::isReadOnlyBatchCommand($cmds);
|
||||
if ($cmds !== null) {
|
||||
return DiffusionMercurialWireProtocol::isReadOnlyBatchCommand(
|
||||
$cmds);
|
||||
}
|
||||
}
|
||||
return DiffusionMercurialWireProtocol::isReadOnlyCommand($cmd);
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
|
@ -878,10 +886,29 @@ final class DiffusionServeController extends DiffusionController {
|
|||
}
|
||||
$args_raw[] = $_SERVER[$header];
|
||||
}
|
||||
$args_raw = implode('', $args_raw);
|
||||
|
||||
return id(new PhutilQueryStringParser())
|
||||
->parseQueryString($args_raw);
|
||||
if ($args_raw) {
|
||||
$args_raw = implode('', $args_raw);
|
||||
return id(new PhutilQueryStringParser())
|
||||
->parseQueryString($args_raw);
|
||||
}
|
||||
|
||||
// Sometimes arguments come in via the query string. Note that this will
|
||||
// not handle multi-value entries e.g. "a[]=1,a[]=2" however it's unclear
|
||||
// whether or how the mercurial protocol should handle this.
|
||||
$query = idx($_SERVER, 'QUERY_STRING', '');
|
||||
$query_pairs = id(new PhutilQueryStringParser())
|
||||
->parseQueryString($query);
|
||||
foreach ($query_pairs as $key => $value) {
|
||||
// Filter out private/internal keys as well as the command itself.
|
||||
if (strncmp($key, '__', 2) && $key != 'cmd') {
|
||||
$args_raw[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Arguments can also come in via request body for POST requests. The
|
||||
// body would be all arguments, url-encoded.
|
||||
return $args_raw;
|
||||
}
|
||||
|
||||
private function formatMercurialArguments($command, array $arguments) {
|
||||
|
|
|
@ -25,7 +25,9 @@ final class DiffusionTagListController extends DiffusionController {
|
|||
'offset' => $pager->getOffset(),
|
||||
);
|
||||
|
||||
if (strlen($drequest->getSymbolicCommit())) {
|
||||
if ($drequest->getSymbolicCommit() !== null
|
||||
&& strlen($drequest->getSymbolicCommit())) {
|
||||
|
||||
$is_commit = true;
|
||||
$params['commit'] = $drequest->getSymbolicCommit();
|
||||
} else {
|
||||
|
|
|
@ -131,6 +131,13 @@ final class DiffusionCommitRef extends Phobject {
|
|||
}
|
||||
|
||||
private function formatUser($name, $email) {
|
||||
if ($name === null) {
|
||||
$name = '';
|
||||
}
|
||||
if ($email === null) {
|
||||
$email = '';
|
||||
}
|
||||
|
||||
if (strlen($name) && strlen($email)) {
|
||||
return "{$name} <{$email}>";
|
||||
} else if (strlen($email)) {
|
||||
|
|
|
@ -87,7 +87,7 @@ final class DiffusionDocumentRenderingEngine
|
|||
$ref->setSymbolMetadata($this->getSymbolMetadata());
|
||||
|
||||
$coverage = $drequest->loadCoverage();
|
||||
if (strlen($coverage)) {
|
||||
if ($coverage !== null && strlen($coverage)) {
|
||||
$ref->addCoverage($coverage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1133,7 +1133,7 @@ final class DiffusionCommitHookEngine extends Phobject {
|
|||
->setHookWait(phutil_microseconds_since($hook_start));
|
||||
|
||||
$identifier = $this->getRequestIdentifier();
|
||||
if (strlen($identifier)) {
|
||||
if ($identifier !== null && strlen($identifier)) {
|
||||
$event->setRequestIdentifier($identifier);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,10 @@ abstract class DiffusionFileFutureQuery
|
|||
|
||||
$drequest = $this->getRequest();
|
||||
|
||||
$name = basename($drequest->getPath());
|
||||
$name = '';
|
||||
if ($drequest->getPath() !== null) {
|
||||
$name = basename($drequest->getPath());
|
||||
}
|
||||
$relative_ttl = phutil_units('48 hours in seconds');
|
||||
|
||||
try {
|
||||
|
|
|
@ -32,8 +32,12 @@ final class DiffusionLowLevelMercurialPathsQuery
|
|||
$hg_paths_command = 'locate --print0 --rev %s -I %s';
|
||||
}
|
||||
|
||||
$match_against = trim($path, '/');
|
||||
$prefix = trim('./'.$match_against, '/');
|
||||
if ($path !== null) {
|
||||
$match_against = trim($path, '/');
|
||||
$prefix = trim('./'.$match_against, '/');
|
||||
} else {
|
||||
$prefix = '.';
|
||||
}
|
||||
list($entire_manifest) = $repository->execxLocalCommand(
|
||||
$hg_paths_command,
|
||||
hgsprintf('%s', $commit),
|
||||
|
|
|
@ -48,6 +48,10 @@ final class DiffusionPathIDQuery extends Phobject {
|
|||
*/
|
||||
public static function normalizePath($path) {
|
||||
|
||||
if ($path === null) {
|
||||
return '/';
|
||||
}
|
||||
|
||||
// Normalize to single slashes, e.g. "///" => "/".
|
||||
$path = preg_replace('@[/]{2,}@', '/', $path);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ final class DiffusionGitRawDiffQuery extends DiffusionRawDiffQuery {
|
|||
}
|
||||
|
||||
$path = $drequest->getPath();
|
||||
if (!strlen($path)) {
|
||||
if ($path === null || !strlen($path)) {
|
||||
$path = '.';
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
final class DiffusionGitRequest extends DiffusionRequest {
|
||||
|
||||
protected function isStableCommit($symbol) {
|
||||
return preg_match('/^[a-f0-9]{40}\z/', $symbol);
|
||||
return $symbol !== null && preg_match('/^[a-f0-9]{40}\z/', $symbol);
|
||||
}
|
||||
|
||||
public function getBranch() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
final class DiffusionMercurialRequest extends DiffusionRequest {
|
||||
|
||||
protected function isStableCommit($symbol) {
|
||||
return preg_match('/^[a-f0-9]{40}\z/', $symbol);
|
||||
return $symbol !== null && preg_match('/^[a-f0-9]{40}\z/', $symbol);
|
||||
}
|
||||
|
||||
public function getBranch() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
final class DiffusionSvnRequest extends DiffusionRequest {
|
||||
|
||||
protected function isStableCommit($symbol) {
|
||||
return preg_match('/^[1-9]\d*\z/', $symbol);
|
||||
return $symbol !== null && preg_match('/^[1-9]\d*\z/', $symbol);
|
||||
}
|
||||
|
||||
protected function didInitialize() {
|
||||
|
|
|
@ -15,9 +15,13 @@ final class DiffusionBrowseTableView extends DiffusionView {
|
|||
$repository = $request->getRepository();
|
||||
require_celerity_resource('diffusion-css');
|
||||
|
||||
$base_path = trim($request->getPath(), '/');
|
||||
if ($base_path) {
|
||||
$base_path = $base_path.'/';
|
||||
if ($request->getPath() !== null) {
|
||||
$base_path = trim($request->getPath(), '/');
|
||||
if ($base_path) {
|
||||
$base_path = $base_path.'/';
|
||||
}
|
||||
} else {
|
||||
$base_path = '';
|
||||
}
|
||||
|
||||
$need_pull = array();
|
||||
|
|
|
@ -71,7 +71,7 @@ abstract class DiffusionView extends AphrontView {
|
|||
$display_name = idx($details, 'name');
|
||||
unset($details['name']);
|
||||
|
||||
if (strlen($display_name)) {
|
||||
if ($display_name !== null && strlen($display_name)) {
|
||||
$display_name = phutil_tag(
|
||||
'span',
|
||||
array(
|
||||
|
|
|
@ -81,10 +81,15 @@ final class DivinerAtom extends Phobject {
|
|||
public function setDocblockRaw($docblock_raw) {
|
||||
$this->docblockRaw = $docblock_raw;
|
||||
|
||||
$parser = new PhutilDocblockParser();
|
||||
list($text, $meta) = $parser->parse($docblock_raw);
|
||||
$this->docblockText = $text;
|
||||
$this->docblockMeta = $meta;
|
||||
if ($docblock_raw !== null) {
|
||||
$parser = new PhutilDocblockParser();
|
||||
list($text, $meta) = $parser->parse($docblock_raw);
|
||||
$this->docblockText = $text;
|
||||
$this->docblockMeta = $meta;
|
||||
} else {
|
||||
$this->docblockText = null;
|
||||
$this->docblockMeta = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ final class DivinerBookQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
|||
$this->phids);
|
||||
}
|
||||
|
||||
if (strlen($this->nameLike)) {
|
||||
if ($this->nameLike !== null && strlen($this->nameLike)) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'name LIKE %~',
|
||||
|
@ -147,7 +147,7 @@ final class DivinerBookQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
|||
$this->names);
|
||||
}
|
||||
|
||||
if (strlen($this->namePrefix)) {
|
||||
if ($this->namePrefix !== null && strlen($this->namePrefix)) {
|
||||
$where[] = qsprintf(
|
||||
$conn,
|
||||
'name LIKE %>',
|
||||
|
|
|
@ -182,7 +182,7 @@ final class DivinerLiveSymbol extends DivinerDAO
|
|||
public function setTitle($value) {
|
||||
$this->writeField('title', $value);
|
||||
|
||||
if (strlen($value)) {
|
||||
if ($value !== null && strlen($value)) {
|
||||
$slug = DivinerAtomRef::normalizeTitleString($value);
|
||||
$hash = PhabricatorHash::digestForIndex($slug);
|
||||
$this->titleSlugHash = $hash;
|
||||
|
|
|
@ -194,7 +194,7 @@ final class DivinerGenerateWorkflow extends DivinerWorkflow {
|
|||
|
||||
$identifier = $args->getArg('repository');
|
||||
$repository = null;
|
||||
if (strlen($identifier)) {
|
||||
if ($identifier !== null && strlen($identifier)) {
|
||||
$repository = id(new PhabricatorRepositoryQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->withIdentifiers(array($identifier))
|
||||
|
|
|
@ -183,11 +183,11 @@ final class PhabricatorFilesComposeAvatarBuiltinFile
|
|||
'image/png');
|
||||
}
|
||||
|
||||
private static function rgba2gd($rgba) {
|
||||
$r = $rgba[0];
|
||||
$g = $rgba[1];
|
||||
$b = $rgba[2];
|
||||
$a = $rgba[3];
|
||||
private static function rgba2gd(array $rgba) {
|
||||
$r = (int)$rgba[0];
|
||||
$g = (int)$rgba[1];
|
||||
$b = (int)$rgba[2];
|
||||
$a = (int)$rgba[3];
|
||||
$a = (1 - $a) * 255;
|
||||
return ($a << 24) | ($r << 16) | ($g << 8) | $b;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ final class FileAllocateConduitAPIMethod
|
|||
->executeOne();
|
||||
}
|
||||
|
||||
if (strlen($name) && !$hash && !$file) {
|
||||
if ($name !== null && strlen($name) && !$hash && !$file) {
|
||||
if ($length > PhabricatorFileStorageEngine::getChunkThreshold()) {
|
||||
// If we don't have a hash, but this file is large enough to store in
|
||||
// chunks and thus may be resumable, try to find a partially uploaded
|
||||
|
|
|
@ -31,6 +31,9 @@ final class FileUploadConduitAPIMethod extends FileConduitAPIMethod {
|
|||
$view_policy = $request->getValue('viewPolicy');
|
||||
|
||||
$data = $request->getValue('data_base64');
|
||||
if ($data === null) {
|
||||
throw new Exception(pht('Field "data_base64" must be non-empty.'));
|
||||
}
|
||||
$data = $this->decodeBase64($data);
|
||||
|
||||
$params = array(
|
||||
|
|
|
@ -29,7 +29,7 @@ final class PhabricatorFileDataController extends PhabricatorFileController {
|
|||
$request_kind = $request->getURIData('kind');
|
||||
$is_download = ($request_kind === 'download');
|
||||
|
||||
if (!strlen($alt) || $main_domain == $alt_domain) {
|
||||
if (($alt === null || !strlen($alt)) || $main_domain == $alt_domain) {
|
||||
// No alternate domain.
|
||||
$should_redirect = false;
|
||||
$is_alternate_domain = false;
|
||||
|
@ -69,7 +69,7 @@ final class PhabricatorFileDataController extends PhabricatorFileController {
|
|||
// an initial request for bytes 0-1 of the audio file, and things go south
|
||||
// if we can't respond with a 206 Partial Content.
|
||||
$range = $request->getHTTPHeader('range');
|
||||
if (strlen($range)) {
|
||||
if ($range !== null && strlen($range)) {
|
||||
list($begin, $end) = $response->parseHTTPRange($range);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ final class PhabricatorFileLightboxController
|
|||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
if (strlen($comment)) {
|
||||
if ($comment !== null && strlen($comment)) {
|
||||
$xactions = array();
|
||||
$xactions[] = id(new PhabricatorFileTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
|
||||
|
|
|
@ -311,12 +311,12 @@ final class PhabricatorFileViewController extends PhabricatorFileController {
|
|||
$file->getStorageHandle());
|
||||
|
||||
$custom_alt = $file->getCustomAltText();
|
||||
if (strlen($custom_alt)) {
|
||||
if ($custom_alt !== null && strlen($custom_alt)) {
|
||||
$finfo->addProperty(pht('Custom Alt Text'), $custom_alt);
|
||||
}
|
||||
|
||||
$default_alt = $file->getDefaultAltText();
|
||||
if (strlen($default_alt)) {
|
||||
if ($default_alt !== null && strlen($default_alt)) {
|
||||
$finfo->addProperty(pht('Default Alt Text'), $default_alt);
|
||||
}
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ final class PhabricatorJupyterDocumentEngine
|
|||
}
|
||||
|
||||
$nbformat = idx($data, 'nbformat');
|
||||
if (!strlen($nbformat)) {
|
||||
if ($nbformat == null || !strlen($nbformat)) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'This document is missing an "nbformat" field. Jupyter notebooks '.
|
||||
|
|
|
@ -60,12 +60,12 @@ abstract class PhabricatorDocumentRenderingEngine
|
|||
}
|
||||
|
||||
$encode_setting = $request->getStr('encode');
|
||||
if (strlen($encode_setting)) {
|
||||
if (phutil_nonempty_string($encode_setting)) {
|
||||
$engine->setEncodingConfiguration($encode_setting);
|
||||
}
|
||||
|
||||
$highlight_setting = $request->getStr('highlight');
|
||||
if (strlen($highlight_setting)) {
|
||||
if (phutil_nonempty_string($highlight_setting)) {
|
||||
$engine->setHighlightingConfiguration($highlight_setting);
|
||||
}
|
||||
|
||||
|
@ -208,12 +208,12 @@ abstract class PhabricatorDocumentRenderingEngine
|
|||
$this->activeEngine = $engine;
|
||||
|
||||
$encode_setting = $request->getStr('encode');
|
||||
if (strlen($encode_setting)) {
|
||||
if (phutil_nonempty_string($encode_setting)) {
|
||||
$engine->setEncodingConfiguration($encode_setting);
|
||||
}
|
||||
|
||||
$highlight_setting = $request->getStr('highlight');
|
||||
if (strlen($highlight_setting)) {
|
||||
if (phutil_nonempty_string($highlight_setting)) {
|
||||
$engine->setHighlightingConfiguration($highlight_setting);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,11 +31,11 @@ final class PhabricatorS3FileStorageEngine
|
|||
$endpoint = PhabricatorEnv::getEnvConfig('amazon-s3.endpoint');
|
||||
$region = PhabricatorEnv::getEnvConfig('amazon-s3.region');
|
||||
|
||||
return (strlen($bucket) &&
|
||||
strlen($access_key) &&
|
||||
strlen($secret_key) &&
|
||||
strlen($endpoint) &&
|
||||
strlen($region));
|
||||
return ($bucket !== null && strlen($bucket) &&
|
||||
$access_key !== null && strlen($access_key) &&
|
||||
$secret_key !== null && strlen($secret_key) &&
|
||||
$endpoint !== null && strlen($endpoint) &&
|
||||
$region !== null && strlen($region));
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ final class PhabricatorS3FileStorageEngine
|
|||
$parts[] = 'phabricator';
|
||||
|
||||
$instance_name = PhabricatorEnv::getEnvConfig('cluster.instance');
|
||||
if (strlen($instance_name)) {
|
||||
if ($instance_name !== null && strlen($instance_name)) {
|
||||
$parts[] = $instance_name;
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ final class PhabricatorEmbedFileRemarkupRule
|
|||
$alt = $options['alt'];
|
||||
}
|
||||
|
||||
if (!strlen($alt)) {
|
||||
if ($alt === null || !strlen($alt)) {
|
||||
$alt = $file->getAltText();
|
||||
}
|
||||
|
||||
|
@ -346,6 +346,9 @@ final class PhabricatorEmbedFileRemarkupRule
|
|||
}
|
||||
|
||||
private function parseDimension($string) {
|
||||
if ($string === null || !strlen($string)) {
|
||||
return null;
|
||||
}
|
||||
$string = trim($string);
|
||||
|
||||
if (preg_match('/^(?:\d*\\.)?\d+%?$/', $string)) {
|
||||
|
|
|
@ -49,7 +49,8 @@ final class PhabricatorImageRemarkupRule extends PhutilRemarkupRule {
|
|||
|
||||
$args += $defaults;
|
||||
|
||||
if (!strlen($args['uri'])) {
|
||||
$uri_arg = $args['uri'];
|
||||
if ($uri_arg === null || !strlen($uri_arg)) {
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
|
@ -57,9 +58,9 @@ final class PhabricatorImageRemarkupRule extends PhutilRemarkupRule {
|
|||
// validate it more carefully before proxying it, but if whatever the user
|
||||
// has typed isn't even close, just decline to activate the rule behavior.
|
||||
try {
|
||||
$uri = new PhutilURI($args['uri']);
|
||||
$uri = new PhutilURI($uri_arg);
|
||||
|
||||
if (!strlen($uri->getProtocol())) {
|
||||
if ($uri->getProtocol() === null || !strlen($uri->getProtocol())) {
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
// update the parent file if a MIME type hasn't been provided. This matters
|
||||
// for large media files like video.
|
||||
$mime_type = idx($params, 'mime-type');
|
||||
if (!strlen($mime_type)) {
|
||||
if ($mime_type === null || !strlen($mime_type)) {
|
||||
$file->setMimeType('application/octet-stream');
|
||||
}
|
||||
|
||||
|
@ -856,7 +856,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
// instance identity in the path allows us to distinguish between requests
|
||||
// originating from different instances but served through the same CDN.
|
||||
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');
|
||||
if (strlen($instance)) {
|
||||
if ($instance !== null && strlen($instance)) {
|
||||
$parts[] = '@'.$instance;
|
||||
}
|
||||
|
||||
|
@ -903,7 +903,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
$parts[] = 'xform';
|
||||
|
||||
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');
|
||||
if (strlen($instance)) {
|
||||
if ($instance !== null && strlen($instance)) {
|
||||
$parts[] = '@'.$instance;
|
||||
}
|
||||
|
||||
|
@ -1278,7 +1278,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
public function getAltText() {
|
||||
$alt = $this->getCustomAltText();
|
||||
|
||||
if (strlen($alt)) {
|
||||
if ($alt !== null && strlen($alt)) {
|
||||
return $alt;
|
||||
}
|
||||
|
||||
|
@ -1309,7 +1309,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
$parts = array();
|
||||
|
||||
$name = $this->getName();
|
||||
if (strlen($name)) {
|
||||
if ($name !== null && strlen($name)) {
|
||||
$parts[] = $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ final class PhabricatorGlobalUploadTargetView extends AphrontView {
|
|||
require_celerity_resource('global-drag-and-drop-css');
|
||||
|
||||
$hint_text = $this->getHintText();
|
||||
if (!strlen($hint_text)) {
|
||||
if ($hint_text === null || !strlen($hint_text)) {
|
||||
$hint_text = "\xE2\x87\xAA ".pht('Drop Files to Upload');
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ final class PhabricatorFileAltTextTransaction
|
|||
$old_value = $this->getOldValue();
|
||||
$new_value = $this->getNewValue();
|
||||
|
||||
if (!strlen($old_value)) {
|
||||
if ($old_value == null || !strlen($old_value)) {
|
||||
return pht(
|
||||
'%s set the alternate text for this file to %s.',
|
||||
$this->renderAuthor(),
|
||||
$this->renderNewValue());
|
||||
} else if (!strlen($new_value)) {
|
||||
} else if ($new_value === null || !strlen($new_value)) {
|
||||
return pht(
|
||||
'%s removed the alternate text for this file (was %s).',
|
||||
$this->renderAuthor(),
|
||||
|
@ -50,13 +50,13 @@ final class PhabricatorFileAltTextTransaction
|
|||
$old_value = $this->getOldValue();
|
||||
$new_value = $this->getNewValue();
|
||||
|
||||
if (!strlen($old_value)) {
|
||||
if ($old_value === null || !strlen($old_value)) {
|
||||
return pht(
|
||||
'%s set the alternate text for %s to %s.',
|
||||
$this->renderAuthor(),
|
||||
$this->renderObject(),
|
||||
$this->renderNewValue());
|
||||
} else if (!strlen($new_value)) {
|
||||
} else if ($new_value === null || !strlen($new_value)) {
|
||||
return pht(
|
||||
'%s removed the alternate text for %s (was %s).',
|
||||
$this->renderAuthor(),
|
||||
|
|
|
@ -515,7 +515,7 @@ EOREMARKUP
|
|||
}
|
||||
}
|
||||
|
||||
if (!strlen($receiver_name)) {
|
||||
if ($receiver_name === null || !strlen($receiver_name)) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'Call omits required "receiver" parameter. Specify the PHID '.
|
||||
|
@ -523,7 +523,7 @@ EOREMARKUP
|
|||
}
|
||||
|
||||
$message_type = $request->getValue('type');
|
||||
if (!strlen($message_type)) {
|
||||
if ($message_type === null || !strlen($message_type)) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'Call omits required "type" parameter. Specify the type of '.
|
||||
|
|
|
@ -103,7 +103,7 @@ final class HarbormasterBuildPlanEditEngine
|
|||
$key);
|
||||
$behavior_option = $object->getPlanProperty($storage_key);
|
||||
|
||||
if (!strlen($behavior_option)) {
|
||||
if ($behavior_option === null || !strlen($behavior_option)) {
|
||||
$behavior_option = $behavior->getPlanOption($object)->getKey();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ final class HeraldTranscriptPHIDType extends PhabricatorPHIDType {
|
|||
$id = $xscript->getID();
|
||||
|
||||
$handle->setName(pht('Transcript %s', $id));
|
||||
$handle->setURI("/herald/transcript/${id}/");
|
||||
$handle->setURI("/herald/transcript/{$id}/");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue