Skip to content

Commit 80fdf23

Browse files
committed
Fix PHP failure when uninstalling
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent b645c85 commit 80fdf23

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

migrations/m4_serialize_to_json.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ public function update_data()
3333
*/
3434
public function serialize_to_json($cfg)
3535
{
36+
// This check is needed to prevent errors when uninstalling this migration/extension
37+
json_decode($this->config[$cfg], false);
38+
if (json_last_error() === JSON_ERROR_NONE)
39+
{
40+
return '';
41+
}
42+
3643
$data = unserialize(trim($this->config[$cfg]), ['allowed_classes' => false]);
3744

3845
return $data ? json_encode($data) : '';

0 commit comments

Comments
 (0)