Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card Widget Deprecation Notices #3823

Closed
joeparsons opened this issue Oct 25, 2024 · 0 comments · Fixed by #3864
Closed

Card Widget Deprecation Notices #3823

joeparsons opened this issue Oct 25, 2024 · 0 comments · Fixed by #3864
Assignees
Labels
bug Something isn't working

Comments

@joeparsons
Copy link
Member

joeparsons commented Oct 25, 2024

Problem/Motivation

The card widget currently generates PHP deprecation notices when previewing cards which have no link uri.

Describe the bug

Deprecated function: str_starts_with(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\az_card\Plugin\Field\FieldWidget\AZCardWidget->formElement() (line 173 of /src/az-quickstart-scaffolding/web/profiles/custom/az_quickstart/modules/custom/az_card/src/Plugin/Field/FieldWidget/AZCardWidget.php)
#0 /src/az-quickstart-scaffolding/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /src/az-quickstart-scaffolding/web/profiles/custom/az_quickstart/modules/custom/az_card/src/Plugin/Field/FieldWidget/AZCardWidget.php(173): str_starts_with()
#3 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Field/WidgetBase.php(459): Drupal\az_card\Plugin\Field\FieldWidget\AZCardWidget->formElement()
#4 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Field/WidgetBase.php(219): Drupal\Core\Field\WidgetBase->formSingleElement()
#5 /src/az-quickstart-scaffolding/web/profiles/custom/az_quickstart/modules/custom/az_card/src/Plugin/Field/FieldWidget/AZCardWidget.php(339): Drupal\Core\Field\WidgetBase->formMultipleElements()
#6 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Field/WidgetBase.php(120): Drupal\az_card\Plugin\Field\FieldWidget\AZCardWidget->formMultipleElements()
#7 /src/az-quickstart-scaffolding/web/profiles/custom/az_quickstart/modules/custom/az_card/src/Plugin/Field/FieldWidget/AZCardWidget.php(95): Drupal\Core\Field\WidgetBase->form()
#8 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(190): Drupal\az_card\Plugin\Field\FieldWidget\AZCardWidget->form()
#9 /src/az-quickstart-scaffolding/web/modules/contrib/paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php(835): Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm()
#10 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Field/WidgetBase.php(459): Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget->formElement()
#11 /src/az-quickstart-scaffolding/web/modules/contrib/paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php(1381): Drupal\Core\Field\WidgetBase->formSingleElement()
#12 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Field/WidgetBase.php(120): Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget->formMultipleElements()
#13 /src/az-quickstart-scaffolding/web/modules/contrib/paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php(1503): Drupal\Core\Field\WidgetBase->form()
#14 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(190): Drupal\paragraphs\Plugin\Field\FieldWidget\ParagraphsWidget->form()
#15 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Entity/ContentEntityForm.php(121): Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm()
#16 /src/az-quickstart-scaffolding/web/core/modules/node/src/NodeForm.php(134): Drupal\Core\Entity\ContentEntityForm->form()
#17 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\node\NodeForm->form()
#18 [internal function]: Drupal\Core\Entity\EntityForm->buildForm()
#19 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array()
#20 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Form/FormBuilder.php(375): Drupal\Core\Form\FormBuilder->retrieveForm()
#21 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Form/FormBuilder.php(633): Drupal\Core\Form\FormBuilder->rebuildForm()
#22 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm()
#23 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#24 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#25 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#26 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#27 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#28 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#29 /src/az-quickstart-scaffolding/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#30 /src/az-quickstart-scaffolding/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#31 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#32 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#33 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#34 /src/az-quickstart-scaffolding/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#35 /src/az-quickstart-scaffolding/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#36 /src/az-quickstart-scaffolding/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#37 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#38 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#39 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#40 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#41 /src/az-quickstart-scaffolding/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#42 /src/az-quickstart-scaffolding/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#43 {main}

To Reproduce

  • Create a card deck which contains a card which has no link URI.
  • Save the page
  • Edit the page
  • Open the card deck and the associated card
  • Close them, and repeat
  • Check the Drupal watchdog log for PHP deprecation notices

Proposed resolution

The card widget should guard against using the link uri without checking its value first.

Expected behavior

Using the card widget should not generate PHP notices.

@tadean tadean self-assigned this Nov 5, 2024
@tadean tadean added the bug Something isn't working label Nov 5, 2024
@tadean tadean changed the title [Placeholder] Card widget deprecation notices Card Widget Deprecation Notices Nov 5, 2024
tadean pushed a commit that referenced this issue Nov 5, 2024
@bberndt-uaz bberndt-uaz linked a pull request Nov 8, 2024 that will close this issue
32 tasks
@danahertzberg danahertzberg moved this from To triage to In progress in 2.11.x Patch Release Issues Nov 13, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in 2.11.x Patch Release Issues Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants