MODX Community

Problems with Migx, backend Menu and files

Summary

I have copied a working ModX (2.6.x) site to a testserver with XAmpp (Php 7.3) and MariaDb.
I upgraded it to 2.7.2.pl.
The site works Ok, but some Migx-backend grids are sometimes empty.

This is the error in the errorlog:

[2020-05-15 16:53:18] (ERROR @ C:\xampp\htdocs\core\model\modx\modprocessor.class.php : 260) Processor failed creating output array due to JSON error 5

Step to reproduce

Mgix “table” with blob-field column.


Browse through the data

Observed behavior

If there is data (a file) in the blob fields then the grid stays empty.
Errorlog: Processor failed creating output array due to JSON error 5

Expected behavior

I don’t use a blob column in my grid, so why is a blob field present in the output?

Environment

MODX version: MODX Revolution 2.7.2-pl (traditional)
Databasetype: mysql
Database version: 10.4.11-MariaDB
Database characterset: latin1

Extra information:
I inspected the json output and I discovered that the contents of the blobfields is also stored in the JSON-data even when I don’t put these columns in the grid or on a formtab.
It took me some experimenting but I created a workaround.
I changed core\components\migx\processors\mgr\default\getlist.php.

I reset the values of the “file” fields

$rows = array();
if ($collection = $xpdo->getCollection($classname, $c)) {
    $pk = $xpdo->getPK($classname);
    foreach ($collection as $object) {
        $row = $object->toArray();
// ugly filter
		if (isset($row['confirmationfile'])) $row['confirmationfile'] = '';
		if (isset($row['file'])) $row['file'] = '';
		if (isset($row['reportfile'])) $row['reportfile'] = '';
		if (isset($row['Joined_confirmationfile'])) $row['Joined_confirmationfile'] = '';
		
		
        $row['id'] = !isset($row['id']) ? $row[$pk] : $row['id'];
        $rows[] = $row;
    }
}

This is an ungly workaround. I think it would be better to filter the columns in this line:
$c->select($xpdo->getSelectColumns($classname, $classname));

But it would be best if the Migx system only selected the columns used in the Columns definition.
Questions:

  1. How do I prevent “blob” columns in the JSON-output?
  2. Is this issue related to MigxDb (long)blob fields contain "0" in stead of filecontents?
  3. I got this error as well: (ERROR in modProcessor::run @ C:\xampp\htdocs\core\model\modx\modprocessor.class.php : 177) Flat file processor support, used for action mgr/migxdb/getList with path C:/xampp/htdocs-portal/core/components/migx/processors/mgr/migxdb/getlist.php, is deprecated since version 2.7.0.
    Is this the cause of my problems and if so, how do I create a correct backend menu without using “Flat file processor support”?

I hope this is enough information for someone to give me a hint for a solution.