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.

Comments

cdesautels created an issue. See original summary.

  • swirt committed d1f081bb on 1.0.x
    Issue #3485680 by cdesautels: Undefined Constant in OperationsBase->...
swirt’s picture

Good find. The conditions to invoke the default are when the units are days, instead or seconds or minutes. While I as in there I also realized this would report the duration as days, when it should be hours. I just fixed that too.

swirt’s picture

Status: Active » Fixed
swirt’s picture

Status: Fixed » Closed (fixed)

Thank you @cdesautels for reporting this, and patching it. This was just released as 1.0.7