@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

don't throw BadMethodCallException on diffs that add images

Summary:
I don't know if there is something more sinister going on
under the covers, but we have a couple of diffs that trigger:

Unhandled Exception ("BadMethodCallException")
Call to a member function getMetadata() on a non-object

when the diff page is handling its async render calls. One diff
in particular has multiple image adds and thus has a stack of of these
error dialogs to close.

This isn't a new regression, we just haven't gotten around to debugging
it until now (reported on 6/12)

One revision that triggers it has two diffs. If I show Base -> Diff 1
I don't hit the error. When I select Base -> Diff 2, or Diff 1 -> Diff
2, the error triggers.

I don't understand what this means, but this diff avoids the null object
reference that causes the exception.

Test Plan:
Load the offending diff, don't hit the error. The diff loads
the images that were added

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D6851

+12 -4
+12 -4
src/applications/differential/parser/DifferentialChangesetParser.php
··· 825 825 $new_phid = idx($metadata, 'new:binary-phid'); 826 826 } else { 827 827 $vs_changeset = id(new DifferentialChangeset())->load($vs); 828 - $vs_metadata = $vs_changeset->getMetadata(); 829 - $old_phid = idx($vs_metadata, 'new:binary-phid'); 828 + $old_phid = null; 829 + $new_phid = null; 830 + 831 + // TODO: This is spooky, see D6851 832 + if ($vs_changeset) { 833 + $vs_metadata = $vs_changeset->getMetadata(); 834 + $old_phid = idx($vs_metadata, 'new:binary-phid'); 835 + } 830 836 831 837 $changeset = id(new DifferentialChangeset())->load($id); 832 - $metadata = $changeset->getMetadata(); 833 - $new_phid = idx($metadata, 'new:binary-phid'); 838 + if ($changeset) { 839 + $metadata = $changeset->getMetadata(); 840 + $new_phid = idx($metadata, 'new:binary-phid'); 841 + } 834 842 } 835 843 836 844 if ($old_phid || $new_phid) {