- Issue created by @khaldoon_masud
- ๐ซ๐ฎFinland sthomen
I ran into this as well on Drupal 10.1, it seems that the validation of the field somehow fouls up.
In this validation, SelectionPluginManager->getSelectionHandler() is called , and the second time the result of $field_definition->getSetting('hander') is null which causes the error with uasort in getInstance().
I patched this by setting the 'handler' key in ViewFieldItem::defaultStorageSettings(), it is probably the wrong thing to but will fix the crash for those in dire need.
- ๐บ๐ธUnited States hockey2112
Thanks for this, I ran into this issue today. The patch works. Can this be rolled into a new release ASAP?
- ๐ฆ๐นAustria maxilein
There is a patch already. It works (D10.1 php 8.1)
Just for the sake of finding this important issue faster via google:
TypeError: uasort(): Argument #1 ($array) must be of type array, null given in uasort() (line 65 of core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginManager.php). Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager->getPluginId() (Line: 50) Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager->getInstance() (Line: 101) Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager->getSelectionHandler() (Line: 97) Drupal\Core\Entity\Plugin\Validation\Constraint\ValidReferenceConstraintValidator->validate() (Line: 202) Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints() (Line: 154) Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (Line: 106) Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate() (Line: 93) Drupal\Core\TypedData\Validation\RecursiveValidator->validate() (Line: 132) Drupal\Core\TypedData\TypedData->validate() (Line: 307) Drupal\Core\Field\FieldItemList->defaultValuesFormValidate() (Line: 241) Drupal\field_ui\Form\FieldConfigEditForm->validateForm() call_user_func_array() (Line: 82) Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 275) Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118) Drupal\Core\Form\FormValidator->validateForm() (Line: 593) Drupal\Core\Form\FormBuilder->processForm() (Line: 325) Drupal\Core\Form\FormBuilder->buildForm() (Line: 73) Drupal\Core\Controller\FormController->getContentResult() (Line: 39) Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult() call_user_func_array() (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592) Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182) Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58) Drupal\Core\StackMiddleware\Session->handle() (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704) Drupal\Core\DrupalKernel->handle() (Line: 19)
- Status changed to RTBC
about 1 year ago 9:46am 20 October 2023 - ๐ฆ๐บAustralia jannakha Brisbane!
patch #2 works, please release the module!
- ๐บ๐ธUnited States hockey2112
Ran into this again today on a different website. Can this be rolled into a new release of the module?
- ๐ฏ๐ตJapan ilfelice
Howdy,
FWIW, patch #2 works here too. Drupal 10.1.5 here.
Would be really nice to have a release with this patch. ;)
- ๐ฌ๐งUnited Kingdom fonant
Patch #2 works to fix the problem for me, too.
- ๐ฉ๐ชGermany thomaswalther Rhein-Main Area
Patch #2 works to fix the problem for me, too.
- ๐บ๐ธUnited States Chris Burge
I can confirm that patch #2 addresses the issue. The behavior is reproducible when trying to add a new View field to a bundle.
+1 for cutting a release.
- ๐น๐ญThailand AlfTheCat
Patch #2 and the patch found here: https://www.drupal.org/project/viewfield/issues/3267240 ๐ Undefined array key "items_to_display" RTBC solved the issue for me.
- ๐ณ๐ฟNew Zealand xurizaemon ลtepoti, Aotearoa ๐
Looks a good candidate for upcoming 3.0 release? Plenty of RTBC+1s here.
- ๐ฎ๐นItaly itamair
#2 patch worked for me also. Let's deploy it in a new module release?
- First commit to issue fork.
- Status changed to Needs work
8 months ago 9:02pm 7 May 2024 - ๐บ๐ธUnited States danflanagan8 St. Louis, US
I turned the patch into an MR, but the tests are failing because of schema issues:
> Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for field.storage.node.field_view_test with the following errors: field.storage.node.field_view_test:settings.handler missing schema
I'd like to fix that before merging.
- Status changed to Needs review
8 months ago 9:19pm 7 May 2024 - Status changed to RTBC
8 months ago 2:41am 8 May 2024 - ๐ฆ๐บAustralia jannakha Brisbane!
thanks for the update.
tested and it works.please release a new version!
- Status changed to Fixed
8 months ago 12:36pm 8 May 2024 -
danflanagan8 โ
committed b67fb578 on 8.x-3.x
Issue #3381787 by danflanagan8, sthomen, khaldoon_masud, hockey2112,...
-
danflanagan8 โ
committed b67fb578 on 8.x-3.x
- ๐บ๐ธUnited States danflanagan8 St. Louis, US
I just tagged 8.x-3.0-beta8 โ , which includes this fix. Thanks, all!
Automatically closed - issue fixed for 2 weeks with no activity.
@danflanagan8
The release doesn't contain the fix even though in the git repo it is. Strange. Please check the ZIP on
https://www.drupal.org/project/viewfield/releases/8.x-3.0-beta8 โ
- ๐บ๐ธUnited States danflanagan8 St. Louis, US
@Defcon0, I see the change to
ViewfieldItem::defaultFieldSettings
in beta8. It's more likely that the fix just doesn't work.See ๐ Cannot select display of view in default value - possible regression Active
- ๐ท๐บRussia DD 85
I'm working on creating a new website. And today, for the first time, I downloaded and installed the Viewfield module for this site.
As described above, I encountered two errors:
Deprecated function: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager->getInstance() (line 45 of \core\lib\Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager.php)
TypeError: uasort(): Argument #1 ($array) must be of type array, null given in uasort() (line 65 of \core\lib\Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager.php).I found that there is no patch in the release of viewfield 8.x-3.0-beta 8 https://www.drupal.org/project/viewfield/issues/3381787#comment-15199519 ๐ Getting PHP errors when setting default value Fixed
The viewfield 8.x-3.x-dev 8 May 2024 development release does not have this patch either.I applied this patch manually by adding a line
'handler' => 'default:view',
and it helped me.
The fix is working, but it has not yet been applied to any release version. - ๐บ๐ธUnited States danflanagan8 St. Louis, US
@DD 85, please see the test results reported in #19. The patch in #2 is not sufficient.
- ๐ท๐บRussia DD 85
Why does #24 ๐ Getting PHP errors when setting default value Fixed say that this has been fixed and the status is Closed (fixed)?
- ๐บ๐ธUnited States danflanagan8 St. Louis, US
@DD 85, it's because I turned the patch into an MR, made an update such that the tests pass, got an RTBC from someone, and then merged the MR.
- ๐บ๐ธUnited States danflanagan8 St. Louis, US
A more successful fix is being attempted in the related issue: ๐ Cannot select display of view in default value - possible regression Active