- Issue created by @cbfannin
- Status changed to Postponed: needs info
almost 2 years ago 4:10pm 3 February 2023 Thanks for the report. Why is the variable null? We have had so many reports like this and in many cases we don't accept workaround patches but rather seek to find out why bad data is arriving at the library function.
Can you replicate this by installing a new Drupal site?
- π¦πΊAustralia marc.groth
I am coming across the same issue; and as far as I can tell it is not an issue with custom code.
This is my scenario:
I have a view that includes 2 arguments. The first (and problematic) one is 'Has taxonomy term ID'. I have default values set for this; but if none are found (i.e. there is no valid taxonomy term), then the resulting value is NULL. It looks like that is because of this line of code:
$arg = (isset($this->args[$position]) && $this->args[$position] !== '') ? $this->args[$position] : NULL;
Which can be found in the _buildArguments() function in the ViewExecutable.php class.
Changing this value to:
$arg = (isset($this->args[$position]) && $this->args[$position] !== '') ? $this->args[$position] : '';
Fixes the issue for me... But I'm not sure what the knock on effects may be for a change like this. If there are no foreseeable issues, then I can provide a patch with this change.
The following line of code may also need updating (possibly removing?), in case the code is ever executed (in which case the NULL value will again break functionality):
$arg = $arg !== '' ? $arg : NULL;
This is also in the same function, a few lines below the aforementioned one.
- Status changed to Active
almost 2 years ago 2:54am 13 February 2023 - π¦πΊAustralia marc.groth
Upon further investigation, it seems that changing that line of code breaks other arguments.
It seems that this code:
$arg = $arg !== '' ? $arg : NULL;
Should be changed to something like:
$arg = $arg !== '' ? $arg : -1;
That fixes it on my side without breaking anything else (from what I can see).
This is on line 1094
- π¦πΊAustralia marc.groth
Also FWIW, this is not specific to Drupal 10 and instead relates to PHP 8.1. I have tested this on Drupal 9.4.8 and 9.4.11 with the same results.
- π«π·France ericdsd France
Hi i have the same issue on a view with several contextual filters,
the warning only occurs on backoffice previews, or on frontend if ajax is enabled. - π«π·France ericdsd France
The issue also makes ajax filtering returning no results whereas the results are ok with ajax turned off.
Here is a patch against core 9.5.4. if ($argument !== null) { $args = preg_split('/\s+/', $argument, -1, PREG_SPLIT_NO_EMPTY); }
This will prevent the deprecated warning from being triggered when $argument is null.
- Status changed to Needs review
over 1 year ago 11:18am 16 May 2023 - last update
over 1 year ago CI aborted - last update
over 1 year ago CI aborted - π³π±Netherlands Lendude Amsterdam
Thanks for providing the steps to reproduce this, indeed easy enough to trigger this.
Easy Steps:
* Install Umami
* Edit the content View
* Add a contextual filter on ID
* Set default to 'Taxonomy ID from URL'
* Check 'Specify validation criteria'
* Set 'Validator' to taxonomy term
* Choose option 'One or more IDs separated by , or +'
* Try to save and reload the Preview
* Check spam in watchdogOk, so now we know that NULL is a valid value for validation, we can add a test and the check for NULL! Adding a full blown functional test for this seems overkill in this issue, so lets just do a unit test
This adds a test for with and without multiple set and passing in NULL
The test only patch is the interdiff.
- last update
over 1 year ago 29,383 pass, 1 fail - last update
over 1 year ago 29,387 pass, 2 fail - π³π±Netherlands Lendude Amsterdam
Ignore those patches, here are the correct ones!
The last submitted patch, 11: 3338973-10-TEST_ONLY.patch, failed testing. View results β
The last submitted patch, 11: 3338973-10.patch, failed testing. View results β
- last update
over 1 year ago 29,388 pass - last update
over 1 year ago 30,334 pass - π§πͺBelgium borisson_ Mechelen, π§πͺ
Does this mean we need to add an update hook to change views that currently have NULL as a value? If we don't need that, this change looks great and has sufficient test coverage.
- π³π±Netherlands Lendude Amsterdam
This is only for contextual filter value validation, so the value should be contextual and not be set in the View, so I don't think there would be anything to update here.
- Status changed to RTBC
over 1 year ago 10:40am 17 May 2023 - π§πͺBelgium borisson_ Mechelen, π§πͺ
In that case, I think we can get this in.
- last update
over 1 year ago 30,334 pass - last update
over 1 year ago 30,334 pass - last update
over 1 year ago 30,334 pass 38:30 37:18 Running- last update
over 1 year ago 30,335 pass - last update
over 1 year ago 30,335 pass - last update
over 1 year ago 30,335 pass - last update
over 1 year ago 30,335 pass - last update
over 1 year ago 30,335 pass - last update
over 1 year ago 30,335 pass - last update
over 1 year ago 30,338 pass - last update
over 1 year ago 30,338 pass - last update
over 1 year ago 30,338 pass - last update
over 1 year ago 30,341 pass - last update
over 1 year ago 30,341 pass - last update
over 1 year ago 30,341 pass - last update
over 1 year ago 30,333 pass, 2 fail The last submitted patch, 8: 3338973-8.patch, failed testing. View results β
- last update
over 1 year ago 30,337 pass, 2 fail The last submitted patch, 8: 3338973-8.patch, failed testing. View results β
- last update
over 1 year ago 30,341 pass - last update
over 1 year ago 30,341 pass 23:29 20:24 Running- last update
over 1 year ago 30,341 pass - last update
over 1 year ago 30,341 pass - last update
over 1 year ago 30,341 pass - last update
over 1 year ago 30,341 pass - πΊπΈUnited States pcate
+1 RTBC. While reviewing site logs found a lot of these errors. Patch #11 fixed the issue.
23:31 22:17 Running-
larowlan β
committed 7527a854 on 10.1.x
Issue #3338973 by Lendude, cbfannin, ericdsd, marc.groth: Deprecated:...
-
larowlan β
committed 7527a854 on 10.1.x
-
larowlan β
committed c4bbc93c on 11.x
Issue #3338973 by Lendude, cbfannin, ericdsd, marc.groth: Deprecated:...
-
larowlan β
committed c4bbc93c on 11.x
- Status changed to Fixed
over 1 year ago 10:53pm 9 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.