- Issue created by @mcdruid
- Status changed to Needs review
over 1 year ago 5:55pm 24 July 2023 - last update
over 1 year ago 277 pass - 🇬🇧United Kingdom mcdruid 🇬🇧🇪🇺
The schema info for the entity is already available, so perhaps something simple like this would work..
- last update
over 1 year ago 277 pass - last update
over 1 year ago 277 pass - last update
over 1 year ago 277 pass - last update
over 1 year ago 278 pass - 🇬🇧United Kingdom mcdruid 🇬🇧🇪🇺
The comments mention that
$condition
can include multiple values, so we should take that into account even if core's existing test coverage doesn't seem to exercise it in this specific case.This patch adds another test that passes multiple term names as the condition. (I'd consider adding this test to core but will leave it here for now).
If we change the operator to LIKE when multiple string conditions are specified, we end up with invalid SQL - e.g.:
Exception Uncaught e database.inc 262 PDO->prepare() PDOException: SQLSTATE[HY000]: General error: 1 near "ESCAPE": syntax error: SELECT taxonomy_term_data.tid AS entity_id, :entity_type AS entity_type, NULL AS revision_id FROM {taxonomy_term_data} taxonomy_term_data WHERE (taxonomy_term_data.name LIKE :db_condition_placeholder_0_0, :db_condition_placeholder_0_1 ESCAPE '\') ; Array ( [:entity_type] => taxonomy_term [:db_condition_placeholder_0_0] => hRzsFtm1 [:db_condition_placeholder_0_1] => wOz545cY ) in EntityCacheControllerHelper::entityCacheLoad() (line 112 of /var/www/html/sites/all/modules/contrib/entitycache/includes/entitycache.entitycachecontrollerhelper.inc).
I don't think it's worth trying to work around that here; let's just keep it simple and change the operator when there's only one value in a string condition.
Realistically this change isn't going to do much on the majority of real world sites, but having completely clean test coverage for entitycache is worth making this small tweak for if we're going to make one or more new releases.
Including a noop patch so we can verify test failures without the operator change.
- last update
over 1 year ago 278 pass - last update
over 1 year ago 278 pass - last update
over 1 year ago 275 pass, 2 fail - last update
over 1 year ago 275 pass, 2 fail - last update
over 1 year ago 278 pass - last update
over 1 year ago 278 pass - last update
over 1 year ago 278 pass - last update
over 1 year ago 278 pass - 🇬🇧United Kingdom mcdruid 🇬🇧🇪🇺
Oops - I accidentally removed an
isset()
.This is looking good to me other than that though.
- last update
over 1 year ago 278 pass - last update
over 1 year ago 278 pass - last update
over 1 year ago 278 pass - last update
over 1 year ago 278 pass - last update
over 1 year ago 278 pass - Status changed to Fixed
over 1 year ago 11:01am 25 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
about 1 year ago 8:52am 28 September 2023 - 🇬🇧United Kingdom mcdruid 🇬🇧🇪🇺
Correction: it's actually only
\TaxonomyTermController::buildQuery
that changes the operator toLIKE
when specifically adding a condition on the term name in core; entitycache now tries to match this:https://git.drupalcode.org/project/entitycache/-/blob/7.x-1.7/includes/e...