From 44cf60dfd2f641008d0d3d26f141c5b7b75ee7c4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2015 10:26:53 -0700 Subject: [PATCH] Fail more softly on funky arcanist project / symbol data Summary: Fixes T8240, probably? Test Plan: This is hard to test locally post-migration -- @btrahan, does it fix things for you? Reviewers: btrahan Reviewed By: btrahan Subscribers: btrahan, epriestley Maniphest Tasks: T8240 Differential Revision: https://secure.phabricator.com/D12903 --- .../sql/autopatches/20150504.symbolsproject.1.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/sql/autopatches/20150504.symbolsproject.1.php b/resources/sql/autopatches/20150504.symbolsproject.1.php index e3c3db66e1..8ab77bbef4 100644 --- a/resources/sql/autopatches/20150504.symbolsproject.1.php +++ b/resources/sql/autopatches/20150504.symbolsproject.1.php @@ -38,7 +38,12 @@ foreach ($raw_projects_data as $project_row) { idx($project_row, 'name', '???')); $symbol_index_projects = $project_row['symbolIndexProjects']; - $symbol_index_projects = phutil_json_decode($symbol_index_projects); + $symbol_index_projects = nonempty($symbol_index_projects, '[]'); + try { + $symbol_index_projects = phutil_json_decode($symbol_index_projects); + } catch (PhutilJSONParserException $ex) { + continue; + } $sources = $repo->getDetail('symbol-sources', array()); foreach ($symbol_index_projects as $index_project) { @@ -50,7 +55,12 @@ foreach ($raw_projects_data as $project_row) { $repo->setDetail('symbol-sources', $sources); $languages = $project_row['symbolIndexLanguages']; - $languages = phutil_json_decode($languages); + $languages = nonempty($languages, '[]'); + try { + $languages = phutil_json_decode($languages); + } catch (PhutilJSONParserException $ex) { + continue; + } $languages = array_merge( $repo->getDetail('symbol-languages', array()),