Problem/Motivation
Trying to reorder on `admin/structure/taxonomy/manage/{VOCAB-ID}/overview
TypeError: Illegal offset type in Drupal\taxonomy\Form\OverviewTerms->submitForm() (line 630 of /mnt/www/html/njcourts/docroot/core/modules/taxonomy/src/Form/OverviewTerms.php).
Proposed resolution
Add int check around values before trying to set.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Screen Recording 2024-09-17 at 4.58.48 PM.mov | 46.57 MB | anandhi karnan |
| #3 | fix-taxonomy-int-error-3471875-1.patch | 781 bytes | ethant |
Issue fork drupal-3471875
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3471875-typeerror-illegal-offset
compare
Comments
Comment #3
ethantComment #4
cilefen commentedThanks for the report and a patch. What is
$raw_term->parentson this site and how do we set this up to reproduce the bug?Comment #5
anandhi karnan commentedHi
I tried to reproduce the issue (TypeError: Illegal offset type in Drupal\taxonomy\Form\OverviewTerms->submitForm()) in Drupal 11.x but was unable to replicate it. I have attached a screen recording for reference.
Here are the steps I followed:
Comment #6
tolstoydotcomIn the existing code, I'm not clear on why it's
$raw_term->parents[0] == 0instead of just!$raw_term->parents[0]or similar. Does$raw_term->parentsalways exist and is it always an array? If$raw_term->parents[0]isNULLor"", is that equivalent to being 0 or does it always have to be a number? What if it's"0"? For the change, it seems like farming the checks out to other methods or a library would be better. Either of those could check if$raw_term->parents[0]exists and has a number or something else.