diff --git a/core/components/formit/processors/mgr/form/getlist.class.php b/core/components/formit/processors/mgr/form/getlist.class.php index 879f4ff9..a696cb80 100644 --- a/core/components/formit/processors/mgr/form/getlist.class.php +++ b/core/components/formit/processors/mgr/form/getlist.class.php @@ -39,8 +39,12 @@ public function prepareQueryBeforeCount(xPDOQuery $c) public function prepareRow(xPDOObject $object) { $ff = $object->toArray(); - if ($ff['encrypted']){ - $ff['values'] = $object->decrypt($ff['values']); + if ($ff['encrypted']) { + $values = $object->decrypt($ff['values']); + if (!is_array(json_decode($values, true))) { + $values = $object->decrypt($ff['values'], 1); + } + $ff['values'] = $values; } return $ff; diff --git a/core/components/formit/processors/mgr/form/migrate.class.php b/core/components/formit/processors/mgr/form/migrate.class.php index 2d63798b..b163a991 100644 --- a/core/components/formit/processors/mgr/form/migrate.class.php +++ b/core/components/formit/processors/mgr/form/migrate.class.php @@ -32,7 +32,12 @@ public function process() } $oldValues = $form->get('values'); $oldValues = $form->decrypt($oldValues, 1); - $newValues = $form->encrypt($oldValues); + /* Fix for when forms are encrypted with openssl, but encryption_type field is not set to 2 */ + if (!is_array(json_decode($oldValues, true))) { + $newValues = $form->get('values'); + } else { + $newValues = $form->encrypt($oldValues); + } if ($newValues) { $this->modx->exec("UPDATE {$this->modx->getTableName('FormItForm')} SET {$this->modx->escape('encryption_type')} = {$this->modx->quote(2)},