Deprecated function: simplexml_load_string()

Created on 20 December 2024, 8 months ago

Problem/Motivation

When saving the Icons vocabulary I get the following PHP error

Deprecated function: simplexml_load_string(): Passing null to parameter #1 ($data) of type string is deprecated in function Drupal\icon_select\Helper\SvgSpriteGenerator::generateSprites() (line 49 in file /var/www/html/web/modules/contrib/icon_select/src/Helper/SvgSpriteGenerator.php). =>

array:27 [▼
  "26: simplexml_load_string()" => array:1 [▶]
  "25: Drupal\icon_select\Helper\SvgSpriteGenerator::generateSprites()" => array:2 [▶]
  "24: icon_select_vocabulary_form_submit()" => array:2 [▶]
  "23: call_user_func_array()" => array:1 [▶]
  "22: Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()" => array:2 [▶]
  "21: Drupal\Core\Form\FormSubmitter->doSubmitForm()" => array:2 [▶]
  "20: Drupal\Core\Form\FormBuilder->processForm()" => array:2 [▶]
  "19: Drupal\Core\Form\FormBuilder->buildForm()" => array:2 [▶]
  "18: Drupal\Core\Controller\FormController->getContentResult()" => array:2 [▶]
  "17: call_user_func_array()" => array:1 [▶]
  "16: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()" => array:1 [▶]
  "15: Drupal\Core\Render\Renderer->executeInRenderContext()" => array:2 [▶]
  "14: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()" => array:2 [▶]
  "13: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()" => array:1 [▶]
  "12: Symfony\Component\HttpKernel\HttpKernel->handleRaw()" => array:2 [▶]
  "11: Symfony\Component\HttpKernel\HttpKernel->handle()" => array:2 [▶]
  "10: Drupal\Core\StackMiddleware\Session->handle()" => array:2 [▶]
  "\u{A0}9: Drupal\Core\StackMiddleware\KernelPreHandle->handle()" => array:2 [▶]
  "\u{A0}8: Drupal\Core\StackMiddleware\ContentLength->handle()" => array:2 [▶]
  "\u{A0}7: Drupal\page_cache\StackMiddleware\PageCache->pass()" => array:2 [▶]
  "\u{A0}6: Drupal\page_cache\StackMiddleware\PageCache->handle()" => array:2 [▶]
  "\u{A0}5: Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()" => array:2 [▶]
  "\u{A0}4: Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()" => array:2 [▶]
  "\u{A0}3: Drupal\Core\StackMiddleware\AjaxPageState->handle()" => array:2 [▶]
  "\u{A0}2: Drupal\Core\StackMiddleware\StackedHttpKernel->handle()" => array:2 [▶]
  "\u{A0}1: Drupal\Core\DrupalKernel->handle()" => array:2 [▶]
  "\u{A0}0: main()" => array:2 [▶]

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Active

Version

3.0

Component

Code

Created by

🇫🇮Finland heikkiy Oulu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @heikkiy
  • 🇮🇳India shivam_tiwari

    I checked this issue on specified drupal version. I am using latest version of icon_select module (3.0.1) but not getting this issue.
    Please correct me if I am skipping any step here.

  • 🇲🇺Mauritius amyesther

    I’m able to reproduce the error only when a taxonomy term references an icon whose SVG file has been deleted from the file system. In that case, saving any taxonomy term triggers the error.
    May be the variable $svg_file_content can be set to empty string instead of NULL if it is empty, to prevent the above error.

Production build 0.71.5 2024