Page MenuHomeDevCentral

Fix PhabricatorStory::getRepositoryPHID null exception
ClosedPublic

Authored by dereckson on Aug 20 2016, 20:29.
Tags
None
Referenced Files
F7065636: D622.id.diff
Sun, Apr 20, 03:14
F7065517: D622.id1542.diff
Sun, Apr 20, 03:10
F7040671: D622.diff
Sat, Apr 19, 15:47
Unknown Object (File)
Wed, Apr 16, 15:20
Unknown Object (File)
Sun, Apr 13, 18:04
Unknown Object (File)
Fri, Apr 11, 05:03
Unknown Object (File)
Mon, Apr 7, 22:04
Unknown Object (File)
Sat, Mar 29, 21:37
Subscribers
None

Details

Summary

When Phabricator fires an notification about an object the Notifications
bot users can't see, PhabricatorStory::getRepositoryPHID API reply is [].

As the code tried to access it as an object, a null exception ensues.
The issue is similar to T916 / f1e56313d6e9.

Fixes T993.

Test Plan
<?php

namespace Nasqueron\Notifications\Tests;

use Nasqueron\Notifications\Analyzers\Phabricator\PhabricatorPayloadAnalyzer;
use Nasqueron\Notifications\Notifications\PhabricatorNotification;
use Nasqueron\Notifications\Phabricator\PhabricatorStory;

class T993Test extends TestCase {

    /**
     * Test T993 is solved.
     */
    public function testT993 () {
        $data = file_get_contents(__DIR__ . '/T993.payload.json');
        $payload = json_decode($data, true);
        $project = "Nasqueron";
        $instance = 'https://devcentral.nasqueron.org';

        $story = PhabricatorStory::loadFromArray($instance, $payload);
        $notification = new PhabricatorNotification($project, $story);
    }
    
}

Diff Detail

Repository
rNOTIF Notifications center
Lint
Lint Passed
Unit
No Test Coverage
Branch
T993

Event Timeline

dereckson retitled this revision from to Fix PhabricatorStory::getRepositoryPHID null exception.
dereckson updated this object.
dereckson edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Aug 20 2016, 20:32
This revision was automatically updated to reflect the committed changes.