Ajax Error in hook_ajax_render_alter

Created on 17 February 2023, almost 2 years ago
Updated 2 May 2023, over 1 year ago

Problem/Motivation

Getting an ajax error that prevends ajax callbacks to be executed. The error occured on drupal commerce checkout - anonymous user - when shipping adresses are validated, but might happen in other circumstances as well.

Error: Call to a member function __toString() on string in frontend_editing_ajax_render_alter() (line 77) 

Proposed resolution

Don't use $command['data']->__toString() as $command['data'] might be not an object or null - cast instead (string) $command['data']

TBD

The render ajax hook should only be executed if user has permission "access frontend editing" and skipped otherwise.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany dreizwo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024