mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-22 12:41:19 +01:00
Fix some PHP 7.4 array index access issues
Summary: Ref T13518. See <https://discourse.phabricator-community.org/t/more-exceptions-when-viewing-diffs/3789/>. Under PHP 7.4, accessing an array index of values like `false` and `null` is no longer valid. This is great, but we occasionally do it. Test Plan: - Upgraded to PHP 7.4. - Loaded revisions with added/changed lines, inlines, and Asana support configured. - Before patch: saw various fatals around accessing indexes of booleans and nulls. - After patch: clean revision. Maniphest Tasks: T13518 Differential Revision: https://secure.phabricator.com/D21172
This commit is contained in:
parent
7355bb7f29
commit
b0c295e545
3 changed files with 15 additions and 0 deletions
|
@ -44,6 +44,10 @@ final class DifferentialAsanaRepresentationField
|
||||||
|
|
||||||
$edge = head($edges[$src_phid][$edge_type]);
|
$edge = head($edges[$src_phid][$edge_type]);
|
||||||
|
|
||||||
|
if (!$edge) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($edge['data']['gone'])) {
|
if (!empty($edge['data']['gone'])) {
|
||||||
return phutil_tag(
|
return phutil_tag(
|
||||||
'em',
|
'em',
|
||||||
|
|
|
@ -1326,9 +1326,15 @@ final class DifferentialChangesetParser extends Phobject {
|
||||||
$old_back = array();
|
$old_back = array();
|
||||||
$new_back = array();
|
$new_back = array();
|
||||||
foreach ($this->old as $ii => $old) {
|
foreach ($this->old as $ii => $old) {
|
||||||
|
if ($old === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$old_back[$old['line']] = $old['line'];
|
$old_back[$old['line']] = $old['line'];
|
||||||
}
|
}
|
||||||
foreach ($this->new as $ii => $new) {
|
foreach ($this->new as $ii => $new) {
|
||||||
|
if ($new === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$new_back[$new['line']] = $new['line'];
|
$new_back[$new['line']] = $new['line'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -593,9 +593,14 @@ final class DifferentialChangesetTwoUpRenderer
|
||||||
|
|
||||||
$map = array();
|
$map = array();
|
||||||
foreach ($new as $offset => $new_line) {
|
foreach ($new as $offset => $new_line) {
|
||||||
|
if ($new_line === null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($new_line['line'] === null) {
|
if ($new_line['line'] === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$map[$new_line['line']] = $offset;
|
$map[$new_line['line']] = $offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue