Undefined Constant in OperationsBase->convertDuration()

Created on 5 November 2024, 10 days ago

Problem/Motivation

There is an unquoted t() placeholder constant in the switch() default handler of convertDuration() in OperationsBase.php.

When the conditions are met (I don't know what they are) that selects this block in the switch statement, a fatal error occurs.

Error: Undefined constant "Drupal\codit_batch_operations_ui\Controller\duration" in Drupal\codit_batch_operations_ui\Controller\OperationsBase->convertDuration() (line 202 of modules/contrib/codit_batch_operations/modules/codit_batch_operations_ui/src/Controller/OperationsBase.php).

Steps to reproduce

This occurs when I try to view a specific Batch job's operations page. I'm not sure what the conditions are the invokes the "default" switch() block.

Proposed resolution

Add quote marks around the constant. I've attached a patch, though it's relative to my code base. I doubt it'll work for most people. You'll need to massage it a bit.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cdesautels

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

Comments & Activities

Production build 0.71.5 2024