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.
This issue is part of #2454513: [meta] Make Drupal 8 work with SQLite.
Drupal\views\Tests\Handler\FilterStringTest
is currently failing on SQLite.
Comment | File | Size | Author |
---|---|---|---|
#18 | 2475247-18.patch | 4.89 KB | amateescu |
#8 | 2475247-8-test-only.patch | 1.07 KB | amateescu |
#8 | 2475247-8.patch | 2.75 KB | amateescu |
#5 | interdiff.txt | 948 bytes | amateescu |
#5 | 2475247-5.patch | 1.68 KB | amateescu |
Comments
Comment #1
amateescu CreditAttribution: amateescu for Drupal Association commentedHaven't been able to figure out this one yet.
Comment #2
amateescu CreditAttribution: amateescu for Drupal Association commentedHere we go, the PHP_INT_MAX limit was quite fun to figure out with @dawehner.
Test run before:
Test run after:
The other test that was affected by this
is_numeric()
addition (Drupal\search\Tests\SearchNumbersTest
) also passes with this patch:Comment #3
dawehnerNitpick: I think it should be possible cast $value == PHP_INT_MAX as well :P
Comment #4
amateescu CreditAttribution: amateescu for Drupal Association commentedThere we go, thanks for reviewing :)
Comment #5
amateescu CreditAttribution: amateescu for Drupal Association commented@amateescu--
Comment #7
dawehnerFor easier future fixes we might should have a custom unit test, what do you think? In case you think it would be not worth to test that nontrivial code,
or use the implicit test coverage we already have, set it please to RTBC.
Comment #8
amateescu CreditAttribution: amateescu for Drupal Association commentedI'm not sure about a unit test but we can definitely have a nice integration test for this.
With the test-only path applied:
With the full patch applied:
Comment #9
dawehnerPerfect, thank you!
Comment #10
webchickLooks like we're missing a test case here for a ridiculously huge number-in-a-string? That's what this patch is intended to fix, yeah?
Comment #11
amateescu CreditAttribution: amateescu for Drupal Association commentedNope, the patch is intended to fix numeric arguments expressed as strings (i.e. '3' instead of 3). If we want to add an assertion for a number higher that PHP_INT_MAX that would just test that that specific number does not work as an argument :)
Comment #12
webchickOk, got it. It's the is_numeric() that's important here, not the PHP_INT_MAX. https://api.drupal.org/api/drupal/core!modules!search!src!Tests!SearchNu... contains various test cases, including:
(hence this bug report :)) ...so we are good.
Committed and pushed to 8.0.x. Thanks!
Comment #17
webchickDown, testbot
Comment #18
amateescu CreditAttribution: amateescu for Drupal Association commentedUnfortunately, this patch broke
Drupal\comment\Tests\CommentPagerTest
, which means the conclusion of my discussion with @dawehner last week was not correct, we can not (and most probably should not) treat numeric string arguments as integers.Specifically, the
is_numeric()
check added in the patch also matches '01.00' and the argument substitution below turns it into 1. That breaks the comment threading algorithm which relies on the value '01.00' to be treated as a string.After some digging, I found the root of the problem in Views, where
_views_query_tag_alter_condition()
does astr_replace()
on all condition values, and because str_replace() always returns a string even if it doesn't do any actual replacement, our integer values are lost / converted.This patch reverts the one from #8 and fixes the underlying bug :)
All the test that could be affected are passing now:
Comment #19
amateescu CreditAttribution: amateescu for Drupal Association commentedHold on, I'm running the entire views test group locally and
Drupal\views\Tests\Handler\HandlerTest
seems to fail with the patch applied.Comment #20
amateescu CreditAttribution: amateescu for Drupal Association commentedNope, false alarm, I just ran it again and it passes. It probably failed because I also started a test run at the same time in the UI for a different test.
Comment #21
dawehnerLooks fine for me, yeah this all is pretty tricky.
I'm curious whether we should make a follow up to the database system to add such functionality (placeholder support), as I could imagine its much easier to be implemented internally than put on top of it, externally.
Comment #22
alexpottAnd there is no use case for using substitutions on non string values?
Comment #23
amateescu CreditAttribution: amateescu for Drupal Association commentedI don't think so. Substitutions have to be special strings like
***SOME_STUFF***
but I'll let @dawehner confirm that :)Comment #24
dawehnerWell yeah, in case you already have the number you achieved what you need to know.
Comment #25
dawehnerComment #26
alexpottThanks for having a think about it @dawehner and @amateescu. Committed 19a7f81 and pushed to 8.0.x. Thanks!