Skip to content

Conversation

@weilai-irl
Copy link
Collaborator

No description provided.

@weilai-irl weilai-irl requested a review from Copilot June 30, 2025 10:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the bug in the action_failed event class by ensuring that get_description() returns data encoded as JSON.

  • Converts the return value of get_description() to a JSON string to ensure proper data type
  • Updates the function to use json_encode consistently for error data representation

*/
public function get_description() {
return $this->data['other'];
return json_encode($this->data['other']);
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While wrapping $this->data['other'] with json_encode fixes the data type issue, consider adding error handling for json_encode failure cases to prevent unexpected behavior if encoding fails.

Suggested change
return json_encode($this->data['other']);
$json = json_encode($this->data['other']);
if ($json === false) {
// Log the error and return a fallback value.
debugging('Failed to encode $this->data["other"] to JSON: ' . json_last_error_msg(), DEBUG_DEVELOPER);
return '{"error": "Failed to encode data"}';
}
return $json;

Copilot uses AI. Check for mistakes.
@weilai-irl weilai-irl added this to the 2025-02 milestone Jun 30, 2025
@weilai-irl weilai-irl self-assigned this Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant