Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14755674
D21862.id52110.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
71 KB
Referenced Files
None
Subscribers
None
D21862.id52110.diff
View Options
diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php
--- a/src/aphront/AphrontRequest.php
+++ b/src/aphront/AphrontRequest.php
@@ -66,7 +66,7 @@
}
public static function parseURILineRange($range, $limit) {
- if (!strlen($range)) {
+ if ($range === null || !strlen($range)) {
return null;
}
@@ -448,11 +448,10 @@
}
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 @@
// 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 @@
$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;
}
diff --git a/src/aphront/response/AphrontFileResponse.php b/src/aphront/response/AphrontFileResponse.php
--- a/src/aphront/response/AphrontFileResponse.php
+++ b/src/aphront/response/AphrontFileResponse.php
@@ -19,7 +19,7 @@
}
public function setDownload($download) {
- if (!strlen($download)) {
+ if ($download === null || !strlen($download)) {
$download = 'untitled';
}
$this->download = $download;
@@ -113,7 +113,8 @@
$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 @@
$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 {
diff --git a/src/aphront/response/AphrontWebpageResponse.php b/src/aphront/response/AphrontWebpageResponse.php
--- a/src/aphront/response/AphrontWebpageResponse.php
+++ b/src/aphront/response/AphrontWebpageResponse.php
@@ -21,7 +21,7 @@
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;',
diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
--- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php
+++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
@@ -18,7 +18,7 @@
$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;
@@ -244,9 +244,9 @@
$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;
@@ -288,7 +288,7 @@
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)) {
@@ -323,7 +323,7 @@
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)) {
@@ -339,7 +339,7 @@
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 {
diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
--- a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
+++ b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
@@ -79,11 +79,21 @@
}
if ($found) {
$this->provider = id(clone $found)->attachProviderConfig($this);
+ $this->providerType = $this->provider->getProviderType();
+ $this->providerDomain = $this->provider->getProviderDomain();
}
}
return $this->provider;
}
+ public function getProviderType() {
+ return $this->getProvider()->getProviderType();
+ }
+
+ public function getProviderDomain() {
+ return $this->getProvider()->getProviderDomain();
+ }
+
public function getURI() {
return '/auth/config/view/'.$this->getID().'/';
}
diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php
--- a/src/applications/base/controller/PhabricatorController.php
+++ b/src/applications/base/controller/PhabricatorController.php
@@ -74,7 +74,7 @@
$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);
diff --git a/src/applications/celerity/controller/CelerityResourceController.php b/src/applications/celerity/controller/CelerityResourceController.php
--- a/src/applications/celerity/controller/CelerityResourceController.php
+++ b/src/applications/celerity/controller/CelerityResourceController.php
@@ -113,7 +113,7 @@
$range = AphrontRequest::getHTTPHeader('Range');
- if (strlen($range)) {
+ if ($range !== null && strlen($range)) {
$response->setContentLength(strlen($data));
list($range_begin, $range_end) = $response->parseHTTPRange($range);
diff --git a/src/applications/config/check/PhabricatorBaseURISetupCheck.php b/src/applications/config/check/PhabricatorBaseURISetupCheck.php
--- a/src/applications/config/check/PhabricatorBaseURISetupCheck.php
+++ b/src/applications/config/check/PhabricatorBaseURISetupCheck.php
@@ -11,7 +11,7 @@
$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(
diff --git a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
--- a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
+++ b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
@@ -53,7 +53,7 @@
}
$expect_user = PhabricatorEnv::getEnvConfig('phd.user');
- if (strlen($expect_user)) {
+ if ($expect_user !== null && strlen($expect_user)) {
try {
$all_daemons = id(new PhabricatorDaemonLogQuery())
diff --git a/src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php b/src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php
--- a/src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php
+++ b/src/applications/config/check/PhabricatorPHPPreflightSetupCheck.php
@@ -124,7 +124,7 @@
}
$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
diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php
--- a/src/applications/config/check/PhabricatorSetupCheck.php
+++ b/src/applications/config/check/PhabricatorSetupCheck.php
@@ -122,7 +122,7 @@
$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);
diff --git a/src/applications/config/check/PhabricatorStorageSetupCheck.php b/src/applications/config/check/PhabricatorStorageSetupCheck.php
--- a/src/applications/config/check/PhabricatorStorageSetupCheck.php
+++ b/src/applications/config/check/PhabricatorStorageSetupCheck.php
@@ -151,19 +151,19 @@
$how_many = 0;
- if (strlen($access_key)) {
+ if (phutil_nonempty_string($access_key)) {
$how_many++;
}
- if (strlen($secret_key)) {
+ if (phutil_nonempty_string($secret_key)) {
$how_many++;
}
- if (strlen($region)) {
+ if (phutil_nonempty_string($region)) {
$how_many++;
}
- if (strlen($endpoint)) {
+ if (phutil_nonempty_string($endpoint)) {
$how_many++;
}
diff --git a/src/applications/config/check/PhabricatorWebServerSetupCheck.php b/src/applications/config/check/PhabricatorWebServerSetupCheck.php
--- a/src/applications/config/check/PhabricatorWebServerSetupCheck.php
+++ b/src/applications/config/check/PhabricatorWebServerSetupCheck.php
@@ -23,7 +23,7 @@
}
$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;
diff --git a/src/applications/config/controller/PhabricatorConfigConsoleController.php b/src/applications/config/controller/PhabricatorConfigConsoleController.php
--- a/src/applications/config/controller/PhabricatorConfigConsoleController.php
+++ b/src/applications/config/controller/PhabricatorConfigConsoleController.php
@@ -85,14 +85,14 @@
$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');
diff --git a/src/applications/config/controller/services/PhabricatorConfigDatabaseStatusController.php b/src/applications/config/controller/services/PhabricatorConfigDatabaseStatusController.php
--- a/src/applications/config/controller/services/PhabricatorConfigDatabaseStatusController.php
+++ b/src/applications/config/controller/services/PhabricatorConfigDatabaseStatusController.php
@@ -837,7 +837,7 @@
$parts = array();
foreach ($properties as $key => $property) {
- if (!strlen($property)) {
+ if (!phutil_nonempty_string($property)) {
continue;
}
diff --git a/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php b/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php
--- a/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php
+++ b/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php
@@ -7,7 +7,7 @@
$viewer = $request->getViewer();
$filter = $request->getURIData('filter');
- if (!strlen($filter)) {
+ if ($filter === null || !strlen($filter)) {
$filter = 'settings';
}
diff --git a/src/applications/console/core/DarkConsoleCore.php b/src/applications/console/core/DarkConsoleCore.php
--- a/src/applications/console/core/DarkConsoleCore.php
+++ b/src/applications/console/core/DarkConsoleCore.php
@@ -114,6 +114,9 @@
* 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)) {
diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php
--- a/src/applications/diffusion/controller/DiffusionController.php
+++ b/src/applications/diffusion/controller/DiffusionController.php
@@ -97,19 +97,19 @@
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;
}
diff --git a/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php b/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php
--- a/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php
+++ b/src/applications/files/builtin/PhabricatorFilesComposeAvatarBuiltinFile.php
@@ -183,11 +183,11 @@
'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;
}
diff --git a/src/applications/files/conduit/FileAllocateConduitAPIMethod.php b/src/applications/files/conduit/FileAllocateConduitAPIMethod.php
--- a/src/applications/files/conduit/FileAllocateConduitAPIMethod.php
+++ b/src/applications/files/conduit/FileAllocateConduitAPIMethod.php
@@ -65,7 +65,7 @@
->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
diff --git a/src/applications/files/controller/PhabricatorFileDataController.php b/src/applications/files/controller/PhabricatorFileDataController.php
--- a/src/applications/files/controller/PhabricatorFileDataController.php
+++ b/src/applications/files/controller/PhabricatorFileDataController.php
@@ -29,7 +29,7 @@
$request_kind = $request->getURIData('kind');
$is_download = ($request_kind === 'download');
- if (!strlen($alt) || $main_domain == $alt_domain) {
+ if (!phutil_nonempty_string($alt) || $main_domain == $alt_domain) {
// No alternate domain.
$should_redirect = false;
$is_alternate_domain = false;
@@ -69,7 +69,7 @@
// 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 (phutil_nonempty_string($range)) {
list($begin, $end) = $response->parseHTTPRange($range);
}
diff --git a/src/applications/files/controller/PhabricatorFileLightboxController.php b/src/applications/files/controller/PhabricatorFileLightboxController.php
--- a/src/applications/files/controller/PhabricatorFileLightboxController.php
+++ b/src/applications/files/controller/PhabricatorFileLightboxController.php
@@ -20,7 +20,7 @@
return new Aphront404Response();
}
- if (strlen($comment)) {
+ if ($comment !== null && strlen($comment)) {
$xactions = array();
$xactions[] = id(new PhabricatorFileTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
diff --git a/src/applications/files/controller/PhabricatorFileViewController.php b/src/applications/files/controller/PhabricatorFileViewController.php
--- a/src/applications/files/controller/PhabricatorFileViewController.php
+++ b/src/applications/files/controller/PhabricatorFileViewController.php
@@ -311,12 +311,12 @@
$file->getStorageHandle());
$custom_alt = $file->getCustomAltText();
- if (strlen($custom_alt)) {
+ if (phutil_nonempty_string($custom_alt)) {
$finfo->addProperty(pht('Custom Alt Text'), $custom_alt);
}
$default_alt = $file->getDefaultAltText();
- if (strlen($default_alt)) {
+ if (phutil_nonempty_string($default_alt)) {
$finfo->addProperty(pht('Default Alt Text'), $default_alt);
}
diff --git a/src/applications/files/document/PhabricatorJupyterDocumentEngine.php b/src/applications/files/document/PhabricatorJupyterDocumentEngine.php
--- a/src/applications/files/document/PhabricatorJupyterDocumentEngine.php
+++ b/src/applications/files/document/PhabricatorJupyterDocumentEngine.php
@@ -323,7 +323,7 @@
}
$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 '.
diff --git a/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php b/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php
--- a/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php
+++ b/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php
@@ -60,12 +60,12 @@
}
$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 @@
$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);
}
diff --git a/src/applications/files/engine/PhabricatorS3FileStorageEngine.php b/src/applications/files/engine/PhabricatorS3FileStorageEngine.php
--- a/src/applications/files/engine/PhabricatorS3FileStorageEngine.php
+++ b/src/applications/files/engine/PhabricatorS3FileStorageEngine.php
@@ -31,11 +31,11 @@
$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 (phutil_nonempty_string($bucket) &&
+ phutil_nonempty_string($access_key) &&
+ phutil_nonempty_string($secret_key) &&
+ phutil_nonempty_string($endpoint) &&
+ phutil_nonempty_string($region));
}
@@ -57,7 +57,7 @@
$parts[] = 'phabricator';
$instance_name = PhabricatorEnv::getEnvConfig('cluster.instance');
- if (strlen($instance_name)) {
+ if (phutil_nonempty_string($instance_name)) {
$parts[] = $instance_name;
}
diff --git a/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php b/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php
--- a/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php
+++ b/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php
@@ -197,7 +197,7 @@
$alt = $options['alt'];
}
- if (!strlen($alt)) {
+ if (!phutil_nonempty_string($alt)) {
$alt = $file->getAltText();
}
@@ -346,6 +346,9 @@
}
private function parseDimension($string) {
+ if ($string === null || !strlen($string)) {
+ return null;
+ }
$string = trim($string);
if (preg_match('/^(?:\d*\\.)?\d+%?$/', $string)) {
diff --git a/src/applications/files/markup/PhabricatorImageRemarkupRule.php b/src/applications/files/markup/PhabricatorImageRemarkupRule.php
--- a/src/applications/files/markup/PhabricatorImageRemarkupRule.php
+++ b/src/applications/files/markup/PhabricatorImageRemarkupRule.php
@@ -49,7 +49,8 @@
$args += $defaults;
- if (!strlen($args['uri'])) {
+ $uri_arg = $args['uri'];
+ if ($uri_arg === null || !strlen($uri_arg)) {
return $matches[0];
}
@@ -57,9 +58,9 @@
// 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];
}
diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php
--- a/src/applications/files/storage/PhabricatorFile.php
+++ b/src/applications/files/storage/PhabricatorFile.php
@@ -288,7 +288,7 @@
// 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 @@
// 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 @@
$parts[] = 'xform';
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');
- if (strlen($instance)) {
+ if ($instance !== null && strlen($instance)) {
$parts[] = '@'.$instance;
}
@@ -1278,7 +1278,7 @@
public function getAltText() {
$alt = $this->getCustomAltText();
- if (strlen($alt)) {
+ if ($alt !== null && strlen($alt)) {
return $alt;
}
@@ -1309,7 +1309,7 @@
$parts = array();
$name = $this->getName();
- if (strlen($name)) {
+ if ($name !== null && strlen($name)) {
$parts[] = $name;
}
diff --git a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
--- a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
+++ b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
@@ -67,7 +67,7 @@
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');
}
diff --git a/src/applications/herald/phid/HeraldTranscriptPHIDType.php b/src/applications/herald/phid/HeraldTranscriptPHIDType.php
--- a/src/applications/herald/phid/HeraldTranscriptPHIDType.php
+++ b/src/applications/herald/phid/HeraldTranscriptPHIDType.php
@@ -35,7 +35,7 @@
$id = $xscript->getID();
$handle->setName(pht('Transcript %s', $id));
- $handle->setURI("/herald/transcript/${id}/");
+ $handle->setURI("/herald/transcript/{$id}/");
}
}
diff --git a/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php b/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php
--- a/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php
+++ b/src/applications/home/menuitem/PhabricatorHomeLauncherProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('More Applications');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('More Applications');
}
@@ -27,17 +27,6 @@
return false;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php b/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
--- a/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
+++ b/src/applications/home/menuitem/PhabricatorHomeProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Built-in Homepage');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Home');
}
@@ -22,17 +22,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function newPageContent(
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
diff --git a/src/applications/meta/query/PhabricatorAppSearchEngine.php b/src/applications/meta/query/PhabricatorAppSearchEngine.php
--- a/src/applications/meta/query/PhabricatorAppSearchEngine.php
+++ b/src/applications/meta/query/PhabricatorAppSearchEngine.php
@@ -45,7 +45,7 @@
->withUnlisted(false);
$name = $saved->getParameter('name');
- if (strlen($name)) {
+ if (phutil_nonempty_string($name)) {
$query->withNameContains($name);
}
diff --git a/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php b/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php
--- a/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php
+++ b/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php
@@ -91,6 +91,10 @@
}
public function isRawCacheDataValid(PhabricatorUser $user, $key, $data) {
+ if ($data === null) {
+ return false;
+ }
+
$parts = explode(',', $data, 2);
$version = reset($parts);
return ($version === $this->getCacheVersion($user));
diff --git a/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Badges');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Badges');
}
@@ -18,17 +18,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Commits');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Commits');
}
@@ -18,17 +18,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleDetailsProfileMenuItem.php
@@ -9,21 +9,10 @@
return pht('User Details');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('User Details');
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleManageProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Manage User');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Manage');
}
@@ -18,17 +18,6 @@
return false;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('User Picture');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('User Picture');
}
diff --git a/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleRevisionsProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Revisions');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Revisions');
}
@@ -18,17 +18,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php b/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php
--- a/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php
+++ b/src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Tasks');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Tasks');
}
@@ -18,17 +18,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectDetailsProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Project Details');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Project Details');
}
@@ -27,17 +27,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Manage Project');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Manage');
}
@@ -27,17 +27,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Project Members');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Members');
}
@@ -17,17 +17,6 @@
return 'fa-users';
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectPictureProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Project Picture');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Project Picture');
}
diff --git a/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Project Points');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Points Bar');
}
diff --git a/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectReportsProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Project Reports');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Reports (Prototype)');
}
@@ -42,17 +42,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Project Subprojects');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Subprojects');
}
@@ -25,17 +25,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php b/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php
--- a/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php
+++ b/src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Project Workboard');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Workboard');
}
@@ -34,17 +34,6 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/search/controller/PhabricatorApplicationSearchController.php b/src/applications/search/controller/PhabricatorApplicationSearchController.php
--- a/src/applications/search/controller/PhabricatorApplicationSearchController.php
+++ b/src/applications/search/controller/PhabricatorApplicationSearchController.php
@@ -112,10 +112,10 @@
$named_query = null;
$run_query = true;
$query_key = $this->queryKey;
- if ($this->queryKey == 'advanced') {
+ if ($query_key == 'advanced') {
$run_query = false;
$query_key = $request->getStr('query');
- } else if (!strlen($this->queryKey)) {
+ } else if ($query_key === null || !strlen($query_key)) {
$found_query_data = false;
if ($request->isHTTPGet() || $request->isQuicksand()) {
@@ -775,7 +775,7 @@
$force_nux) {
// Don't render NUX if the user has clicked away from the default page.
- if (strlen($this->getQueryKey())) {
+ if ($this->getQueryKey() !== null && strlen($this->getQueryKey())) {
return null;
}
@@ -1022,7 +1022,7 @@
$object_name = pht('%s %s', $object->getMonogram(), $object->getName());
// Likewise, the context object can only be a dashboard.
- if (strlen($context_phid)) {
+ if ($context_phid !== null && !strlen($context_phid)) {
$context = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withPHIDs(array($context_phid))
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -179,7 +179,7 @@
$order = $saved->getParameter('order');
$builtin = $query->getBuiltinOrderAliasMap();
- if (strlen($order) && isset($builtin[$order])) {
+ if ($order !== null && strlen($order) && isset($builtin[$order])) {
$query->setOrder($order);
} else {
// If the order is invalid or not available, we choose the first
@@ -872,7 +872,7 @@
protected function readBoolFromRequest(
AphrontRequest $request,
$key) {
- if (!strlen($request->getStr($key))) {
+ if (!phutil_nonempty_string($request->getStr($key))) {
return null;
}
return $request->getBool($key);
@@ -895,7 +895,7 @@
* @task dates
*/
protected function parseDateTime($date_time) {
- if (!strlen($date_time)) {
+ if ($date_time === null || !strlen($date_time)) {
return null;
}
@@ -916,7 +916,7 @@
$start_str = $saved_query->getParameter($start_key);
$start = null;
- if (strlen($start_str)) {
+ if (phutil_nonempty_string($start_str)) {
$start = $this->parseDateTime($start_str);
if (!$start) {
$this->addError(
@@ -929,7 +929,7 @@
$end_str = $saved_query->getParameter($end_key);
$end = null;
- if (strlen($end_str)) {
+ if (phutil_nonempty_string($end_str)) {
$end = $this->parseDateTime($end_str);
if (!$end) {
$this->addError(
@@ -1137,7 +1137,7 @@
$viewer = $this->requireViewer();
$query_key = $request->getValue('queryKey');
- if (!strlen($query_key)) {
+ if ($query_key === null || !strlen($query_key)) {
$saved_query = new PhabricatorSavedQuery();
} else if ($this->isBuiltinQuery($query_key)) {
$saved_query = $this->buildSavedQueryFromBuiltin($query_key);
diff --git a/src/applications/search/engine/PhabricatorProfileMenuEngine.php b/src/applications/search/engine/PhabricatorProfileMenuEngine.php
--- a/src/applications/search/engine/PhabricatorProfileMenuEngine.php
+++ b/src/applications/search/engine/PhabricatorProfileMenuEngine.php
@@ -135,7 +135,7 @@
if ($is_view) {
$selected_item = $this->selectViewItem($view_list, $item_id);
} else {
- if (!strlen($item_id)) {
+ if ($item_id === null || !strlen($item_id)) {
$item_id = self::ITEM_MANAGE;
}
$selected_item = $this->selectEditItem($view_list, $item_id);
@@ -1308,7 +1308,7 @@
// render the default view instead.
$selected_view = null;
- if (strlen($item_id)) {
+ if ($item_id !== null && strlen($item_id)) {
$item_views = $view_list->getViewsWithItemIdentifier($item_id);
if ($item_views) {
$selected_view = head($item_views);
diff --git a/src/applications/search/engine/PhabricatorProfileMenuItemView.php b/src/applications/search/engine/PhabricatorProfileMenuItemView.php
--- a/src/applications/search/engine/PhabricatorProfileMenuItemView.php
+++ b/src/applications/search/engine/PhabricatorProfileMenuItemView.php
@@ -110,7 +110,7 @@
return $this->isExternalLink;
}
- public function setIsLabel($is_label) {
+ public function setIsLabel() {
return $this->setSpecialType('label');
}
@@ -118,7 +118,7 @@
return $this->isSpecialType('label');
}
- public function setIsDivider($is_divider) {
+ public function setIsDivider() {
return $this->setSpecialType('divider');
}
@@ -140,7 +140,7 @@
->setName($this->getName());
$uri = $this->getURI();
- if (strlen($uri)) {
+ if ($uri !== null && strlen($uri)) {
if ($this->getIsExternalLink()) {
if (!PhabricatorEnv::isValidURIForLink($uri)) {
$uri = '#';
@@ -176,7 +176,7 @@
}
$tooltip = $this->getTooltip();
- if (strlen($tooltip)) {
+ if ($tooltip !== null && strlen($tooltip)) {
$view->setTooltip($tooltip);
}
diff --git a/src/applications/search/field/PhabricatorSearchDateField.php b/src/applications/search/field/PhabricatorSearchDateField.php
--- a/src/applications/search/field/PhabricatorSearchDateField.php
+++ b/src/applications/search/field/PhabricatorSearchDateField.php
@@ -17,7 +17,7 @@
}
protected function validateControlValue($value) {
- if (!strlen($value)) {
+ if ($value === null || !strlen($value)) {
return;
}
@@ -32,7 +32,7 @@
}
protected function parseDateTime($value) {
- if (!strlen($value)) {
+ if ($value === null || !strlen($value)) {
return null;
}
diff --git a/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
@@ -19,6 +19,10 @@
return true;
}
+ public function getDefaultName() {
+ return pht('Application');
+ }
+
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$application = $this->getApplication($config);
@@ -27,7 +31,7 @@
}
$name = $this->getName($config);
- if (strlen($name)) {
+ if ($name !== null && strlen($name)) {
return $name;
}
diff --git a/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorConpherenceProfileMenuItem.php
@@ -62,6 +62,10 @@
}
}
+ public function getDefaultName() {
+ return pht('Conpherence');
+ }
+
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$room = $this->getConpherence($config);
@@ -70,7 +74,7 @@
}
$name = $this->getName($config);
- if (strlen($name)) {
+ if ($name !== null && strlen($name)) {
return $name;
}
diff --git a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php
@@ -101,27 +101,26 @@
}
}
+ public function getDefaultName() {
+ return pht('Dashboard');
+ }
+
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$dashboard = $this->getDashboard();
-
if (!$dashboard) {
- if ($this->getDashboardHandle()->getPolicyFiltered()) {
- return pht('Restricted Dashboard');
- } else {
- return pht('Invalid Dashboard');
- }
+ return pht('(Restricted/Invalid Dashboard)');
}
if ($dashboard->isArchived()) {
return pht('Archived Dashboard');
}
- if (strlen($this->getName($config))) {
- return $this->getName($config);
- } else {
- return $dashboard->getName();
+ $name = $this->getName($config);
+ if ($name !== null && strlen($name)) {
+ return $name;
}
+ return $dashboard->getName();
}
public function buildEditEngineFields(
diff --git a/src/applications/search/menuitem/PhabricatorDividerProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorDividerProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorDividerProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorDividerProfileMenuItem.php
@@ -17,8 +17,7 @@
return true;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
+ public function getDefaultName() {
return pht("\xE2\x80\x94");
}
diff --git a/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorEditEngineProfileMenuItem.php
@@ -65,17 +65,22 @@
}
}
+ public function getDefaultName() {
+ return pht('Form');
+ }
+
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$form = $this->getForm();
if (!$form) {
return pht('(Restricted/Invalid Form)');
}
- if (strlen($this->getName($config))) {
- return $this->getName($config);
- } else {
- return $form->getName();
+
+ $name = $this->getName($config);
+ if ($name !== null && strlen($name)) {
+ return $name;
}
+ return $form->getName();
}
public function buildEditEngineFields(
diff --git a/src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorLabelProfileMenuItem.php
@@ -18,6 +18,10 @@
return true;
}
+ public function getDefaultName() {
+ return pht('Label');
+ }
+
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
return $this->getLabelName($config);
diff --git a/src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php
@@ -21,6 +21,10 @@
return true;
}
+ public function getDefaultName() {
+ return pht('Link');
+ }
+
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
return $this->getLinkName($config);
diff --git a/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorManageProfileMenuItem.php
@@ -9,7 +9,7 @@
return pht('Manage Menu');
}
- private function getDefaultName() {
+ public function getDefaultName() {
return pht('Edit Menu');
}
@@ -27,17 +27,6 @@
return false;
}
- public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config) {
- $name = $config->getMenuItemProperty('name');
-
- if (strlen($name)) {
- return $name;
- }
-
- return $this->getDefaultName();
- }
-
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
diff --git a/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorMotivatorProfileMenuItem.php
@@ -17,16 +17,19 @@
return ($object instanceof PhabricatorHomeApplication);
}
+ public function getDefaultName() {
+ return pht('Motivator');
+ }
+
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$options = $this->getOptions();
$name = idx($options, $config->getMenuItemProperty('source'));
- if ($name !== null) {
+ if ($name !== null && strlen($name)) {
return pht('Motivator: %s', $name);
- } else {
- return pht('Motivator');
}
+ return pht('Motivator');
}
public function buildEditEngineFields(
diff --git a/src/applications/search/menuitem/PhabricatorProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorProfileMenuItem.php
@@ -10,9 +10,17 @@
}
abstract public function getMenuItemTypeName();
+ abstract public function getDefaultName();
- abstract public function getDisplayName(
- PhabricatorProfileMenuItemConfiguration $config);
+ public function getDisplayName(
+ PhabricatorProfileMenuItemConfiguration $config) {
+ $name = $config->getMenuItemProperty('name');
+
+ if ($name !== null && strlen($name)) {
+ return $name;
+ }
+ return $this->getDefaultName();
+ }
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
diff --git a/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php
--- a/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorProjectProfileMenuItem.php
@@ -56,17 +56,22 @@
}
}
+ public function getDefaultName() {
+ return pht('Project');
+ }
+
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$project = $this->getProject();
if (!$project) {
return pht('(Restricted/Invalid Project)');
}
- if (strlen($this->getName($config))) {
- return $this->getName($config);
- } else {
- return $project->getName();
+
+ $name = $this->getName($config);
+ if ($name !== null && strlen($name)) {
+ return $name;
}
+ return $project->getName();
}
public function buildEditEngineFields(
diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php
--- a/src/applications/transactions/editengine/PhabricatorEditEngine.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php
@@ -941,7 +941,7 @@
}
} else {
$form_key = $request->getURIData('formKey');
- if (strlen($form_key)) {
+ if ($form_key !== null && strlen($form_key)) {
$config = $this->loadEditEngineConfigurationWithIdentifier($form_key);
if (!$config) {
@@ -971,14 +971,14 @@
}
$page_key = $request->getURIData('pageKey');
- if (!strlen($page_key)) {
+ if ($page_key === null || !strlen($page_key)) {
$pages = $this->getPages($object);
if ($pages) {
$page_key = head_key($pages);
}
}
- if (strlen($page_key)) {
+ if ($page_key !== null && strlen($page_key)) {
$page = $this->selectPage($object, $page_key);
if (!$page) {
return new Aphront404Response();
@@ -1169,7 +1169,7 @@
if ($this->getIsCreate()) {
$template = $request->getStr('template');
- if (strlen($template)) {
+ if ($template !== null && strlen($template)) {
$template_object = $this->newObjectFromIdentifier(
$template,
array(
@@ -1909,7 +1909,7 @@
$comment_text = $request->getStr('comment');
$comment_metadata = $request->getStr('comment_metadata');
- if (strlen($comment_metadata)) {
+ if ($comment_metadata !== null && strlen($comment_metadata)) {
$comment_metadata = phutil_json_decode($comment_metadata);
}
@@ -2009,7 +2009,7 @@
$xactions[] = $xaction;
}
- if (strlen($comment_text) || !$xactions) {
+ if (($comment_text !== null && strlen($comment_text)) || !$xactions) {
$xactions[] = id(clone $template)
->setTransactionType(PhabricatorTransactions::TYPE_COMMENT)
->setMetadataValue('remarkup.control', $comment_metadata)
diff --git a/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php b/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php
--- a/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php
@@ -89,6 +89,9 @@
}
public function hasTagView() {
+ if ($this->getTagText() === null) {
+ return false;
+ }
return (bool)strlen($this->getTagText());
}
diff --git a/src/applications/transactions/editfield/PhabricatorEditField.php b/src/applications/transactions/editfield/PhabricatorEditField.php
--- a/src/applications/transactions/editfield/PhabricatorEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorEditField.php
@@ -418,7 +418,7 @@
}
$instructions = $this->getControlInstructions();
- if (strlen($instructions)) {
+ if ($instructions !== null && strlen($instructions)) {
$form->appendRemarkupInstructions($instructions);
}
diff --git a/src/applications/transactions/editfield/PhabricatorTextEditField.php b/src/applications/transactions/editfield/PhabricatorTextEditField.php
--- a/src/applications/transactions/editfield/PhabricatorTextEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorTextEditField.php
@@ -18,7 +18,7 @@
$control = new AphrontFormTextControl();
$placeholder = $this->getPlaceholder();
- if (strlen($placeholder)) {
+ if ($placeholder !== null && strlen($placeholder)) {
$control->setPlaceholder($placeholder);
}
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -617,7 +617,7 @@
return true;
case PhabricatorTransactions::TYPE_SPACE:
$space_phid = $xaction->getNewValue();
- if (!strlen($space_phid)) {
+ if ($space_phid === null || !strlen($space_phid)) {
// If an install has no Spaces or the Spaces controls are not visible
// to the viewer, we might end up with the empty string here instead
// of a strict `null`, because some controller just used `getStr()`
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadModularDatasourceController.php
@@ -39,7 +39,7 @@
$parameters = array();
$raw_parameters = $request->getStr('parameters');
- if (strlen($raw_parameters)) {
+ if ($raw_parameters !== null && strlen($raw_parameters)) {
try {
$parameters = phutil_json_decode($raw_parameters);
} catch (PhutilJSONParserException $ex) {
diff --git a/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php b/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php
--- a/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php
+++ b/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php
@@ -214,6 +214,9 @@
if (!$limit) {
$limit = count($results);
}
+ if (!$offset) {
+ $offset = 0;
+ }
$results = array_slice($results, $offset, $limit, $preserve_keys = true);
}
diff --git a/src/infrastructure/cluster/PhabricatorDatabaseRef.php b/src/infrastructure/cluster/PhabricatorDatabaseRef.php
--- a/src/infrastructure/cluster/PhabricatorDatabaseRef.php
+++ b/src/infrastructure/cluster/PhabricatorDatabaseRef.php
@@ -316,6 +316,8 @@
}
public static function newRefs() {
+ $default_host = PhabricatorEnv::getEnvConfig('mysql.host');
+
$default_port = PhabricatorEnv::getEnvConfig('mysql.port');
$default_port = nonempty($default_port, 3306);
@@ -328,6 +330,7 @@
$config = PhabricatorEnv::getEnvConfig('cluster.databases');
return id(new PhabricatorDatabaseRefParser())
+ ->setDefaultHost($default_host)
->setDefaultPort($default_port)
->setDefaultUser($default_user)
->setDefaultPass($default_pass)
diff --git a/src/infrastructure/cluster/PhabricatorDatabaseRefParser.php b/src/infrastructure/cluster/PhabricatorDatabaseRefParser.php
--- a/src/infrastructure/cluster/PhabricatorDatabaseRefParser.php
+++ b/src/infrastructure/cluster/PhabricatorDatabaseRefParser.php
@@ -3,10 +3,20 @@
final class PhabricatorDatabaseRefParser
extends Phobject {
+ private $defaultHost;
private $defaultPort = 3306;
private $defaultUser;
private $defaultPass;
+ public function setDefaultHost($default_host) {
+ $this->defaultHost = $default_host;
+ return $this;
+ }
+
+ public function getDefaultHost() {
+ return $this->defaultHost;
+ }
+
public function setDefaultPort($default_port) {
$this->defaultPort = $default_port;
return $this;
@@ -35,6 +45,7 @@
}
public function newRefs(array $config) {
+ $default_host = $this->getDefaultHost();
$default_port = $this->getDefaultPort();
$default_user = $this->getDefaultUser();
$default_pass = $this->getDefaultPass();
@@ -76,6 +87,17 @@
$refs[$key] = $ref;
}
+ if (empty($refs)) {
+ $refs['default'] = id(new PhabricatorDatabaseRef())
+ ->setHost($default_host)
+ ->setPort($default_port)
+ ->setUser($default_user)
+ ->setPass($default_pass)
+ ->setDisabled(false)
+ ->setIsMaster(true)
+ ->setUsePersistentConnections(true);
+ }
+
$is_partitioned = ($master_count > 1);
if ($is_partitioned) {
$default_ref = null;
diff --git a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
--- a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
+++ b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
@@ -89,7 +89,7 @@
$field_handles = array_select_keys($handles, $phids[$field_key]);
$instructions = $field->getInstructionsForEdit();
- if (strlen($instructions)) {
+ if ($instructions !== null && strlen($instructions)) {
$form->appendRemarkupInstructions($instructions);
}
diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php
--- a/src/infrastructure/env/PhabricatorEnv.php
+++ b/src/infrastructure/env/PhabricatorEnv.php
@@ -125,7 +125,7 @@
// If an instance identifier is defined, write it into the environment so
// it's available to subprocesses.
$instance = self::getEnvConfig('cluster.instance');
- if (strlen($instance)) {
+ if ($instance !== null && strlen($instance)) {
putenv('PHABRICATOR_INSTANCE='.$instance);
$_ENV['PHABRICATOR_INSTANCE'] = $instance;
}
diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php
--- a/src/infrastructure/javelin/markup.php
+++ b/src/infrastructure/javelin/markup.php
@@ -77,7 +77,10 @@
$is_post = (strcasecmp($http_method, 'POST') === 0);
$http_action = idx($attributes, 'action');
- $is_absolute_uri = preg_match('#^(https?:|//)#', $http_action);
+ $is_absolute_uri = false;
+ if ($http_action != null) {
+ $is_absolute_uri = preg_match('#^(https?:|//)#', $http_action);
+ }
if ($is_post) {
diff --git a/src/view/control/AphrontTableView.php b/src/view/control/AphrontTableView.php
--- a/src/view/control/AphrontTableView.php
+++ b/src/view/control/AphrontTableView.php
@@ -135,7 +135,7 @@
$col_classes = array();
foreach ($this->columnClasses as $key => $class) {
- if (strlen($class)) {
+ if ($class !== null && strlen($class)) {
$col_classes[] = $class;
} else {
$col_classes[] = null;
diff --git a/src/view/form/control/AphrontFormControl.php b/src/view/form/control/AphrontFormControl.php
--- a/src/view/form/control/AphrontFormControl.php
+++ b/src/view/form/control/AphrontFormControl.php
@@ -109,7 +109,7 @@
}
public function isEmpty() {
- return !strlen($this->getValue());
+ return $this->getValue() === null || !strlen($this->getValue());
}
public function getSerializedValue() {
@@ -171,9 +171,8 @@
array('class' => 'aphront-form-input'),
$this->renderInput());
- $error = null;
- if (strlen($this->getError())) {
- $error = $this->getError();
+ $error = $this->error;
+ if ($error !== null && strlen($error)) {
if ($error === true) {
$error = phutil_tag(
'span',
@@ -185,9 +184,12 @@
array('class' => 'aphront-form-error'),
$error);
}
+ } else {
+ $error = null;
}
- if (strlen($this->getLabel())) {
+ $label = $this->label;
+ if ($label !== null && strlen($label)) {
$label = phutil_tag(
'label',
array(
@@ -203,7 +205,8 @@
$custom_class .= ' aphront-form-control-nolabel';
}
- if (strlen($this->getCaption())) {
+ $caption = $this->caption;
+ if ($caption !== null && strlen($caption)) {
$caption = phutil_tag(
'div',
array('class' => 'aphront-form-caption'),
diff --git a/src/view/form/control/AphrontFormTokenizerControl.php b/src/view/form/control/AphrontFormTokenizerControl.php
--- a/src/view/form/control/AphrontFormTokenizerControl.php
+++ b/src/view/form/control/AphrontFormTokenizerControl.php
@@ -67,8 +67,8 @@
}
$datasource->setViewer($this->getUser());
- $placeholder = null;
- if (!strlen($this->placeholder)) {
+ $placeholder = $this->placeholder;
+ if ($placeholder === null || !strlen($placeholder)) {
$placeholder = $datasource->getPlaceholderText();
}
diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php
--- a/src/view/layout/AphrontSideNavFilterView.php
+++ b/src/view/layout/AphrontSideNavFilterView.php
@@ -97,7 +97,7 @@
->setName($name)
->setType($type);
- if (strlen($icon)) {
+ if ($icon !== null && strlen($icon)) {
$item->setIcon($icon);
}
@@ -145,7 +145,7 @@
public function selectFilter($key, $default = null) {
$this->selectedFilter = $default;
- if ($this->menu->getItem($key) && strlen($key)) {
+ if ($key !== null && strlen($key) && $this->menu->getItem($key)) {
$this->selectedFilter = $key;
}
return $this->selectedFilter;
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -188,7 +188,7 @@
}
}
- if (strlen($prefix)) {
+ if ($prefix !== null && strlen($prefix)) {
$title = $prefix.' '.$title;
}
diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php
--- a/src/view/page/menu/PhabricatorMainMenuView.php
+++ b/src/view/page/menu/PhabricatorMainMenuView.php
@@ -333,7 +333,7 @@
$wordmark_text = PhabricatorCustomLogoConfigType::getLogoWordmark();
- if (!strlen($wordmark_text)) {
+ if ($wordmark_text === null || !strlen($wordmark_text)) {
$wordmark_text = PlatformSymbols::getPlatformServerName();
}
diff --git a/src/view/phui/PHUIInfoView.php b/src/view/phui/PHUIInfoView.php
--- a/src/view/phui/PHUIInfoView.php
+++ b/src/view/phui/PHUIInfoView.php
@@ -44,8 +44,8 @@
return $this;
}
- public function setIsHidden($bool) {
- $this->isHidden = $bool;
+ public function setIsHidden($is_hidden) {
+ $this->isHidden = $is_hidden;
return $this;
}
@@ -147,7 +147,7 @@
}
$title = $this->title;
- if ($title || strlen($title)) {
+ if ($title !== null && strlen($title)) {
$title = phutil_tag(
'h1',
array(
diff --git a/src/view/phui/PHUIObjectItemListView.php b/src/view/phui/PHUIObjectItemListView.php
--- a/src/view/phui/PHUIObjectItemListView.php
+++ b/src/view/phui/PHUIObjectItemListView.php
@@ -120,7 +120,7 @@
require_celerity_resource('phui-oi-color-css');
$header = null;
- if (strlen($this->header)) {
+ if ($this->header !== null && strlen($this->header)) {
$header = phutil_tag(
'h1',
array(
@@ -141,7 +141,7 @@
}
$items = $this->items;
- } else if ($this->allowEmptyList) {
+ } else if ($this->getAllowEmptyList()) {
$items = null;
} else {
$string = nonempty($this->noDataString, pht('No data.'));
diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php
--- a/src/view/phui/PHUIObjectItemView.php
+++ b/src/view/phui/PHUIObjectItemView.php
@@ -97,6 +97,10 @@
return $this;
}
+ public function getHeader() {
+ return $this->header;
+ }
+
public function setSubHead($subhead) {
$this->subhead = $subhead;
return $this;
@@ -122,10 +126,6 @@
return $this->titleText;
}
- public function getHeader() {
- return $this->header;
- }
-
public function addByline($byline) {
$this->bylines[] = $byline;
return $this;
@@ -659,8 +659,12 @@
$this->getImageIcon());
}
- if ($image && (strlen($this->href) || strlen($this->imageHref))) {
- $image_href = ($this->imageHref) ? $this->imageHref : $this->href;
+ $image_href = $this->href;
+ if ($image_href === null || !strlen($image_href)) {
+ $image_href = $this->imageHref;
+ }
+
+ if ($image && $image_href !== null && strlen($image_href)) {
$image = phutil_tag(
'a',
array(
@@ -873,7 +877,7 @@
'class' => 'phui-oi-status-icon',
);
- if (strlen($label)) {
+ if ($label !== null && strlen($label)) {
$options['sigil'] = 'has-tooltip';
$options['meta'] = array('tip' => $label, 'size' => 300);
}
diff --git a/src/view/phui/PHUITagView.php b/src/view/phui/PHUITagView.php
--- a/src/view/phui/PHUITagView.php
+++ b/src/view/phui/PHUITagView.php
@@ -105,6 +105,10 @@
return $this;
}
+ public function getHref() {
+ return $this->href;
+ }
+
public function setClosed($closed) {
$this->closed = $closed;
return $this;
@@ -126,7 +130,7 @@
}
protected function getTagName() {
- return strlen($this->href) ? 'a' : 'span';
+ return ($this->href !== null && strlen($this->href)) ? 'a' : 'span';
}
public function setContextObject($context_object) {
diff --git a/src/view/widget/AphrontStackTraceView.php b/src/view/widget/AphrontStackTraceView.php
--- a/src/view/widget/AphrontStackTraceView.php
+++ b/src/view/widget/AphrontStackTraceView.php
@@ -30,7 +30,7 @@
$relative = $file;
foreach ($libraries as $library) {
$root = phutil_get_library_root($library);
- if (Filesystem::isDescendant($file, $root)) {
+ if ($file != null && Filesystem::isDescendant($file, $root)) {
$lib = $library;
$relative = Filesystem::readablePath($file, $root);
break;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 4:07 PM (13 h, 16 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7034927
Default Alt Text
D21862.id52110.diff (71 KB)
Attached To
Mode
D21862: Addressing some PHP 8 incompatibilities
Attached
Detach File
Event Timeline
Log In to Comment