Page MenuHomePhabricator

Fix an exception in Tokens if a bad object was given a token
ClosedPublic

Authored by epriestley on Dec 28 2015, 9:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 12:39 AM
Unknown Object (File)
Fri, Apr 26, 5:28 PM
Unknown Object (File)
Sat, Apr 6, 6:47 PM
Unknown Object (File)
Sat, Apr 6, 6:47 PM
Unknown Object (File)
Sat, Apr 6, 6:46 PM
Unknown Object (File)
Sat, Apr 6, 6:01 PM
Unknown Object (File)
Mar 14 2024, 6:46 PM
Unknown Object (File)
Mar 14 2024, 4:42 PM
Subscribers
None

Details

Summary

Fixes T10057. Root issue is:

  • In the past, you could give tokens to objects of type X (here, Ponder answers).
  • Now, you can't.
  • If you try to load a token on an object of type X, we do a bad call to attach it and fatal.

Instead, make sure objects implement the proper interface before we attach them, and just pretend the token does not exist otherwise.

Test Plan

Faked the exception in T10057, applied patch, got clean tokens page.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Fix an exception in Tokens if a bad object was given a token.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
src/applications/tokens/query/PhabricatorTokenGivenQuery.php
73

This new instanceof check is the actual fix, everything else is just cleaning this up a bit.

chad edited edge metadata.
This revision is now accepted and ready to land.Dec 28 2015, 9:18 PM
This revision was automatically updated to reflect the committed changes.