diff --git a/src/applications/differential/field/specification/maniphesttasks/DifferentialManiphestTasksFieldSpecification.php b/src/applications/differential/field/specification/maniphesttasks/DifferentialManiphestTasksFieldSpecification.php index bd1f9c298d..345520e4ca 100644 --- a/src/applications/differential/field/specification/maniphesttasks/DifferentialManiphestTasksFieldSpecification.php +++ b/src/applications/differential/field/specification/maniphesttasks/DifferentialManiphestTasksFieldSpecification.php @@ -69,10 +69,13 @@ final class DifferentialManiphestTasksFieldSpecification $user = $this->getUser(); $type = ManiphestTransactionType::TYPE_ATTACH; $attach_type = PhabricatorPHIDConstants::PHID_TYPE_DREV; - $attach_data = array($revision->getPHID() => array()); - $tasks = id(new ManiphestTask()) - ->loadAllWhere('phid IN (%Ld)', $this->maniphestTasks); + $tasks = array(); + if ($this->maniphestTasks) { + $tasks = id(new ManiphestTask())->loadAllWhere( + 'phid IN (%Ls)', + $this->maniphestTasks); + } foreach ($tasks as $task) { $transaction = new ManiphestTransaction(); @@ -80,7 +83,10 @@ final class DifferentialManiphestTasksFieldSpecification $transaction->setTransactionType($type); $new = $task->getAttached(); - $new[$attach_type] = $attach_data; + if (empty($new[$attach_type])) { + $new[$attach_type] = array(); + } + $new[$attach_type][$revision->getPHID] = array(); $transaction->setNewValue($new); $maniphest_editor->applyTransactions($task, array($transaction)); diff --git a/src/storage/qsprintf/qsprintf.php b/src/storage/qsprintf/qsprintf.php index befb0f4c73..d955417cef 100644 --- a/src/storage/qsprintf/qsprintf.php +++ b/src/storage/qsprintf/qsprintf.php @@ -283,6 +283,11 @@ function _qsprintf_check_scalar_type($value, $type, $query) { $query, "Expected a scalar or null for %{$type} conversion."); } + if (!is_numeric($value)) { + throw new AphrontQueryParameterException( + $query, + "Expected numeric value for %{$type} conversion."); + } break; case 'Ls': case 's':