- Status changed to RTBC
almost 2 years ago 1:13pm 19 January 2023 - First commit to issue fork.
-
seanB β
committed f900dfc8 on 8.x-2.x authored by
rodrigoaguilera β
Issue #3273497: Passing null to parameter #1 ($data) of type string to...
-
seanB β
committed f900dfc8 on 8.x-2.x authored by
rodrigoaguilera β
- Status changed to Fixed
over 1 year ago 6:46pm 20 March 2023 - π³π±Netherlands seanB Netherlands
Committed, thanks everyone! Had to reroll, so please help test the latest dev version!
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
over 1 year ago 10:45am 28 August 2023 - π·π΄Romania bogdan.dinu
The warning still exists on Drupal 10 with php 8.1 and viewsreference 2.0-beta6.
I attached a patch that fixes the issue in \Plugin\Field\FieldType\ViewsReferenceItem and Plugin\Field\FieldFormatter\ViewsReferenceFieldFormatter as they are using the 'data' array key without checking if it is set.
PS: the warning is generated only for the FieldType but I think adding the check for the FieldFormatter doesn't hurt :) - π―π΅Japan ilfelice
Howdy,
Patch from #26 applied cleanly on a Drupal 10.1 install with newly installed viewsreference 2.0-beta6.
After applying the patch, the error is gone.
- πΊπΈUnited States drupalninja99
When I tried to apply #26 to the latest 2x dev, composer just hangs or says it can't apply the patch.
- πΊπΈUnited States drupalninja99
I am attaching a small patch that resolves the error I am getting in ViewsReferenceFieldFormatter.php.
- π΅π°Pakistan dewancodes
I tried #27 on drupal 10 and it worked fine for me as error gone. Thanks @drupalninja99.
- πΊπΈUnited States xeiro
I'm unable to apply the patch using 9.5x / php 8.1.
- leymannx Berlin
#29 makes the views arguments not being respected anymore. Exactly what's described in π Contextuele filters not respected when used in paragraph Active .
Everybody just needs to update to 2.0-beta7.
- π©πͺGermany Anybody Porta Westfalica
@seanB: Reading the comments here, should this be reopened or should someone please create a follow-up issue (I'd suggest so!)
- π«π·France steveoriol Grenoble π«π·
I have the error on viewsreference:2.0.0-beta7 end php 8.2
Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\viewsreference\Plugin\Field\FieldFormatter\ViewsReferenceFieldFormatter->viewElements() (line 98 of modules/contrib/viewsreference/src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php).
- πΊπΈUnited States daletrexel Minnesota, USA
I've opened a new issue π unserialize() of NULL deprecation returns to ViewsReferenceFieldFormatter Needs review since there has been a re-emergence of a problem that this issue had resolved when it was closed.
π Issue 2919092 breaks BC and causes issues for existing sites Needs review , which was included in the beta7 release, allows null data to be passed to the unserialize() function again, without checking whether data might be null or not:
unserialize($item->getValue()['data'], ['allowed_classes' => FALSE])
As I and others have found, null 'data' is possible in views reference fields (likely those saved a while ago when expectations for this field were looser), so we really need to bring back a sanity check here before calling unseralize().My new ticket proposes a solution to re-fix this particular instance (line 98 of ViewsReferenceFieldFormatter.php)
(The 'data' field stores the "extra settings" configuration, which is also involved in π Configuration schema for "Enable extra settings" (title,pagination,...) incorrect Fixed . I wouldn't be surprised if this is related, but so far I've been unable to reconstruct what previous scenario allowed an empty 'data' field to begin with. It was likely in Drupal 9, which I no longer have an easy way to test.)
- πͺπΈSpain javier_rey
Without patch number 27, I get the warning mentioned in the issue.
But when applying it I don't get any "value" in the method "public function alterView(ViewExecutable $view, $value)" of my "
ViewsReferenceSetting custom setting.My version is 2.0-beta7.