Drupal 9.0.2
PHP 7.4.8
Error:
Drupal\Core\Security\UntrustedCallbackException: Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was Drupal\imce\ImceFileField::preRenderWidget. See https://www.drupal.org/node/2966725 in Drupal\Core\Render\Renderer->doTrustedCallback() (line 96 of /usr/local/var/www/local.daisy_d9/daisyfoundation.org/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php).
Steps:
Install module via composer
enable module from extend page
manage form display for an image field to enable users to use imce
Attempt to go to a content item that has imce enabled
Reviewed: https://www.drupal.org/node/2966725
To get around the issue I made the following change to the module. I've never made a patch file before, but wanted to share the edits in case someone wants to make a patch or runs into the issue.
File: ImceFileField.php
class ImceFileField implements TrustedCallbackInterface {
public static function trustedCallbacks() {
return ['preRenderWidget'];
}
Comments
Comment #2
thallesThis was fixed in dev branch, see: #3149697: php security error when I create content on Drupal 9.0
Comment #3
thalles