- πΊπΈUnited States chucksimply
So is this module unusable then? I see the last release was 2 years ago.
- π΅π±Poland lamp5 Rzeszow
Hmmm, do you see any major issue to commit or any new feature to mark new release?
- πΊπΈUnited States chucksimply
I just see this specific issue keeping the module unusable, and it going untouched for so long. I wish I could assist in contributing a solution, but it's beyond my skillset. Any further thoughts on this error/issue fix?
- πΊπΈUnited States chucksimply
@lamp5, can you provide an update on this issue. Looks like the module is dead without a fix for it.
- πΊπ¦Ukraine _shy Ukraine, Lutsk πΊπ¦
Hi guys.
I just took a quick look at this issue and provided a very short and dirty way how we can skip errors for the case when using 'all' as a contextual filter argument.
This patch shouldn't fix all cases and I created it only just as a workaround to handle specific cases.
Feel free to upgrade it and improve. - π΅π±Poland Alexius
Patch from #13 working for me. Thanks, Diakuju @_shy.
- π΅π±Poland jsobiecki Wroclaw
I'm affected by this problem, and unfortunately patch #13 doesn't work. After some debugging, my impression is that root cause of issue is usage of placeholder() method in ArgOrderStort plugin:
// Attempt to determine the number appended to the query substitutes. // Calling the placeholder function increments the placeholder count by 1, // so we subtract one to get the number that was used before. $placeholder_suffix = str_replace(':' . $left_table . '_' . $left_field, '', $this->query->placeholder($left_table . '_' . $left_field)); if (!empty($placeholder_suffix) && intval($placeholder_suffix) > 1) { $placeholder_suffix = intval($placeholder_suffix) - 1; }
The placeholder generates a field placeholder name with dynamic suffix (number). It uses static variable to provide proper number for suffix. Each execution of placeholder() the method is increasing suffix for sql placeholder.
My scenario is that I have few views that are using same base table. As static variable is not being restarted for each view, the placeholder is increased and provides false (from the views_arg_order_sort) arguments. I'll try to rewrite the code to avoid placeholder() method. It generates unexpected side effects.
- π΅π±Poland jsobiecki Wroclaw
I created the fix for reported issue. Instead of using placeholder() method, I decided to generate SQL query and use regular expression to count all suffixes. The project doesn't have regular test suite, but at my test cases this seemed to fix the issue.
- Merge request !4Issue #3212018 by jsobiecki: SQLSTATE[HY093]: Invalid parameter number: number... β (Open) created by jsobiecki
- Status changed to Needs review
about 1 month ago 12:39am 27 February 2025 - πΊπΈUnited States mariacha1
For me, the patch at #16 wasn't solving the problem because it was a different problem (but the same one from #13). I was passing "all" to the contextual query, like this, if no sort is desired:
all/all
But this when a set of node ids (1, 2, or 3) was desired:
1+2+3/all
The example throwing the error in the description.
I'm adding a patch to go along with #16 to fix this case as well as that one.
- πΊπΈUnited States mariacha1
Whoops, one more small change when combining these -- Patch #19 gives me:
ValueError: max(): Argument #1 ($value) must contain at least one element in max() (line 150 of modules/contrib/views_arg_order_sort/src/Plugin/views/sort/ArgOrderSort.php).
so I'm just bailing out of the function (like #13 does).