When adding a crop type via the form located at /admin/config/media/crop/add, the following fatal error is thrown:

Recoverable fatal error: Object of class Drupal\Core\Link could not be converted to string in Drupal\Core\Database\Statement->execute() (line 59 of core/lib/Drupal/Core/Database/Statement.php).

The crop type is still added, but it obviously quite confusing to the user.

This error is caused by the following line in the save method of the CropTypeForm class:

$context = array_merge($t_args, array('link' => Link::createFromRoute($this->t('View'), 'crop.overview_types')));

To fix this, the Link element being created needs to have its toString() method called. A patch has been attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Scott Robertson created an issue. See original summary.

woprrr’s picture

Status: Needs review » Fixed

Yes ! you right. This error came from #2855792: Replace all of deprecated usages during refactor. I didn't see this error (pehaps cache) during tests.

Thank you to your help/patch. This Major change need to out new minor release to have stable release.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.