Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't auto-create terms with parentheses in them #503

Open
mstenta opened this issue Feb 14, 2022 · 1 comment
Open

Can't auto-create terms with parentheses in them #503

mstenta opened this issue Feb 14, 2022 · 1 comment
Labels

Comments

@mstenta
Copy link
Member

mstenta commented Feb 14, 2022

Describe the bug

It's not possible to auto-create taxonomy terms that have parentheses in them, because Drupal interprets whatever is in the parentheses as the entity ID (even if it's non-numeric), resulting in the following error:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "test" LINE 6: ...t_type')) AND ("taxonomy_term_field_data"."tid" IN ('test')) ^: SELECT "base_table"."revision_id" AS "revision_id", "base_table"."tid" AS "tid", "taxonomy_term_field_data_2"."name" AS "name" FROM "taxonomy_term_data" "base_table" INNER JOIN "taxonomy_term_field_data" "taxonomy_term_field_data" ON "taxonomy_term_field_data"."tid" = "base_table"."tid" LEFT JOIN "taxonomy_term_field_data" "taxonomy_term_field_data_2" ON "taxonomy_term_field_data_2"."tid" = "base_table"."tid" WHERE ("taxonomy_term_field_data"."vid" IN (:db_condition_placeholder_0)) AND ("taxonomy_term_field_data"."tid" IN (:db_condition_placeholder_1)) ORDER BY "taxonomy_term_field_data_2"."name" ASC NULLS FIRST; Array ( [:db_condition_placeholder_0] => plant_type [:db_condition_placeholder_1] => test ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 271 of /opt/drupal/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

This appears to be a Drupal core bug. I think this is it: https://www.drupal.org/project/drupal/issues/2924783

This is somewhat related to another recent bug: #502

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Records > Assets > Plant
  2. Click on Add Plant Asset
  3. Enter any name for the asset.
  4. Enter "Crop (test)" in the "Crop/variety" field.
  5. Click "Save".
  6. Screen show: "The website encountered an unexpected error. Please try again later." / see error in logs

Expected behavior

Terms with non-numeric text within parentheses should be created.

@mstenta mstenta added the bug label Feb 14, 2022
@mstenta
Copy link
Member Author

mstenta commented Oct 30, 2023

This also applies to existing terms, I think. In other words, if you have a term with parentheses in it already, the same error will occur if you try to reference it. (Need to confirm this.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant