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.
| Comment | File | Size | Author |
|---|---|---|---|
| codit_ui_fixes_placeholder_constant.patch | 1.2 KB | cdesautels |
Comments
Comment #3
swirtGood 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.
Comment #4
swirtComment #5
swirtThank you @cdesautels for reporting this, and patching it. This was just released as 1.0.7