Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The logic in StateItem::getAllowedStates
is a bit too optimistic. If the field has a value of an non-existing state (because you changed the workflow while developing) you'll get an PHP error down the lane. I'd suggest to add the current state only if it exists in the list of all states. See attached patch.
Comment | File | Size | Author |
---|---|---|---|
#5 | php-error-with-invalid-value_2761265_5.patch | 1.82 KB | stmh |
#3 | fix_php_error_for_nonexisting_states_2761265_3.patch | 883 bytes | stmh |
Comments
Comment #2
stmh CreditAttribution: stmh commentedComment #3
stmh CreditAttribution: stmh commentedHere's the patch
Comment #4
mglamanfixing status.
putting to needs work because we should get a test on this.
Comment #5
stmh CreditAttribution: stmh commentedAttached is a new patch which adds preliminary tests for getSettableOptions which invoked an PHP error in the old getAllowedValues() function when providing an invalid state-value.
Comment #7
bojanz CreditAttribution: bojanz at Centarro commentedCommitted, thanks!