Page MenuHomePhabricator

Fix an issue where "Export Data" could fail if a user had a nonempty custom policy preference
ClosedPublic

Authored by epriestley on Tue, Jun 16, 1:41 PM.

Details

Summary

The "Export Data" workflow incorrectly uses the "Policy Favorites" setting to choose a default export format. This is just a copy/paste error; the correct setting exists and is unused.

If the setting value is an array (as the "Policy Favorites" value often is), we try to use it as an array index. This generates a runtime exception after D21044.

[2020-06-16 06:32:12] EXCEPTION: (RuntimeException) Illegal offset type in isset or empty at [<arcanist>/src/error/PhutilErrorHandler.php:263]
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<phabricator>/src/applications/search/controller/PhabricatorApplicationSearchController.php:460]
  • Use the correct setting.
  • Make sure the value we read is a string.
Test Plan
  • Used "Export Data" with a nonempty, array-valued "Policy Favorites" setting.
    • Before: runtime exception.
    • After: clean export.
  • Used "Export Data" again, saw my selection from the first time persisted.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Tue, Jun 16, 1:41 PM
This revision was not accepted when it landed; it landed in state Needs Review.Tue, Jun 16, 1:42 PM
epriestley requested review of this revision.
This revision was automatically updated to reflect the committed changes.