mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Fix PHP 8.1 "strlen(null)" exceptions which block rendering the Conpherence page
Summary: `strlen()` was used in Phabricator to check if a generic value is a non-empty string. This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement. Note: this may highlight other absurd input values that might be worth correcting instead of just ignoring. If phutil_nonempty_string() throws an exception in your instance, report it to Phorge to evaluate and fix that specific corner case. Closes T15304 Test Plan: Applied these four changes (on top of `D25144`, `D25145`, `D25146`, `D25147`, `D25150`, `D25151`, `D25152`, `D25153`) and `/conpherence/` page finally rendered in web browser. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15304 Differential Revision: https://we.phorge.it/D25154
This commit is contained in:
parent
4c758f29ae
commit
e65ac7b880
2 changed files with 5 additions and 4 deletions
|
@ -135,7 +135,8 @@ final class ConpherenceThreadQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) {
|
||||||
if ($this->participantPHIDs !== null || strlen($this->fulltext)) {
|
if ($this->participantPHIDs !== null ||
|
||||||
|
phutil_nonempty_string($this->fulltext)) {
|
||||||
return qsprintf($conn_r, 'GROUP BY thread.id');
|
return qsprintf($conn_r, 'GROUP BY thread.id');
|
||||||
} else {
|
} else {
|
||||||
return $this->buildApplicationSearchGroupClause($conn_r);
|
return $this->buildApplicationSearchGroupClause($conn_r);
|
||||||
|
@ -152,7 +153,7 @@ final class ConpherenceThreadQuery
|
||||||
id(new ConpherenceParticipant())->getTableName());
|
id(new ConpherenceParticipant())->getTableName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->fulltext)) {
|
if (phutil_nonempty_string($this->fulltext)) {
|
||||||
$joins[] = qsprintf(
|
$joins[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'JOIN %T idx ON idx.threadPHID = thread.phid',
|
'JOIN %T idx ON idx.threadPHID = thread.phid',
|
||||||
|
@ -234,7 +235,7 @@ final class ConpherenceThreadQuery
|
||||||
$this->participantPHIDs);
|
$this->participantPHIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->fulltext)) {
|
if (phutil_nonempty_string($this->fulltext)) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)',
|
'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)',
|
||||||
|
|
|
@ -106,7 +106,7 @@ final class ConpherenceThreadSearchEngine
|
||||||
$engines = array();
|
$engines = array();
|
||||||
|
|
||||||
$fulltext = $query->getParameter('fulltext');
|
$fulltext = $query->getParameter('fulltext');
|
||||||
if (strlen($fulltext) && $conpherences) {
|
if (phutil_nonempty_string($fulltext) && $conpherences) {
|
||||||
$context = $this->loadContextMessages($conpherences, $fulltext);
|
$context = $this->loadContextMessages($conpherences, $fulltext);
|
||||||
|
|
||||||
$author_phids = array();
|
$author_phids = array();
|
||||||
|
|
Loading…
Reference in a new issue