When clicking the "Edit description" button of a directory listing, nothing happens in the UI but this error is thrown in the Apache error log:

Uncaught PHP Exception Drupal\\Core\\Database\\DatabaseExceptionWrapper: "SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '))' at line 2: SELECT f.*\nFROM \n{filebrowser_content} f\nWHERE (f.fid IN ()); Array\n(\n)\n" at /var/www/html/drupal/core/lib/Drupal/Core/Database/Connection.php line 671

The problem is that the nodeContentLoadMultiple() function in FilebrowserStorage.php sometimes gets a string and sometimes an array, but $query->condition('f.fid', $fids, 'IN') requires an array.

A workaround would be to write:

if (!is_array($fids)) {
$fids = explode(',', $fids);
}

at the beginning of nodeContentLoadMultiple(), but it would be better to be consistent and have all callers pass the same data type (either string or array). An array probably makes more sense, and would be consistent with the function having the same name in Common.php.

I can write the patch, if you want to. :)

Comments

LpSolit created an issue. See original summary.

  • clivesj committed 6058b50 on 8.x-2.x
    Issue #2832564 by LpSolit: Editing a file description fails with a SQL...
clivesj’s picture

Status: Active » Fixed

FilebrowserStorage::nodeContentLoadMultiple was already changed to accept arrays, but the description-form was still sending a string.
Fixed now.
Thanks!

clivesj’s picture

Status: Fixed » Closed (fixed)