- Issue created by @jurgenhaas
- Merge request !31Issue #3360589: TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in count() → (Open) created by jurgenhaas
- last update
over 1 year ago 39 pass - Status changed to Needs review
over 1 year ago 7:13am 16 May 2023 - last update
over 1 year ago 38 pass, 2 fail - 🇩🇪Germany jurgenhaas Gottmadingen
Another related issue is this warning:
Warning: Undefined array key 591307 in Drupal\diff\Controller\PluginRevisionController->buildRevisionsNavigation() (line 253 of /var/www/html/web/modules/contrib/diff/src/Controller/PluginRevisionController.php)
which happens, if left and right revision are either identical or if the left revision is newer than the right revision. And that produces a watchdog record for EVERY revision ID, i.e. in our case hundreds of thousands. ;-)
I've updated the MR to also validate this case and produce an applicable error message.
- 🇨🇭Switzerland miro_dietiker Switzerland
Uhm, for globally "every revision id", not even limited to the entity id?
Or you have hundreds of thousands revision ids on this single entity? - 🇩🇪Germany jurgenhaas Gottmadingen
Well, I wasn't able to verify that in all detail. What happened is in
\Drupal\diff\Controller\PluginRevisionController::buildRevisionsNavigation
this code block:$i = 0; // Find the previous revision. while ($left_revision_id > $revision_ids[$i]) { $i += 1; }
From
$revision_ids[$i]
we got 756 watchdog entries in sequential order for the counter, while the node only has 2 revisions. TBH, I didn't debug how that came about, I only prevented that from happening again with the validation of the form in the MR. - 🇨🇭Switzerland miro_dietiker Switzerland
Interesting, i think this part should be improved with an array sort / search, without loop.
- 🇩🇪Germany jurgenhaas Gottmadingen
Just checked the case which happened with a URL like
/node/23017/revisions/view/166027/166014/visual_inline
, so the diff between the rev IDs is166027 - 166014 = 13
, so not related to the 756 watchdog entries. - 🇩🇪Germany jurgenhaas Gottmadingen
i think this part should be improved with an array sort / search, without loop.
Yeah, I think that makes sense. Still, the form validation should still be present to let the user know when they selected something meaningless.
- 🇨🇭Switzerland miro_dietiker Switzerland
Sure this should be fixed.
But from the way i used it, i thought from / to direction don't matter. As long as they are different.
Are you sure about bigger / smaller check is needed?Maybe we can just swap the revisions when the sequence is wrong?
Making it just work is better than telling the user to choose something different... - 🇩🇪Germany jurgenhaas Gottmadingen
Are you sure about bigger / smaller check is needed?
At the moment, yes, the order matters. I'm able to reproduce that. However, swapping them should resolve that automatically, I just wasn't sure if there were multiple places where this needed to be checked. However, the validation that they are not equal is still required, as we can't auto-correct that input error.
- last update
over 1 year ago 39 pass - last update
over 1 year ago 39 pass - First commit to issue fork.
- heddn Nicaragua
For this to be reviewed and accepted, please review https://git.drupalcode.org/project/diff#contribution-guidelines. Specifically we'll want to see some tests.