Page MenuHomeDevCentral

Fix PhabricatorStory::getRepositoryPHID null exception
ClosedPublic

Authored by dereckson on Aug 20 2016, 20:29.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 5, 20:59
Unknown Object (File)
Mon, Mar 3, 23:18
Unknown Object (File)
Thu, Feb 27, 21:35
Unknown Object (File)
Fri, Feb 21, 07:14
Unknown Object (File)
Tue, Feb 18, 19:34
Unknown Object (File)
Tue, Feb 11, 04:17
Unknown Object (File)
Tue, Feb 11, 04:17
Unknown Object (File)
Tue, Feb 11, 04:16
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 Not Applicable
Unit
Tests Not Applicable

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.