Deprecated function: preg_match(): Passing null to parameter

Created on 18 July 2022, almost 2 years ago
Updated 30 January 2024, 5 months ago

Problem/Motivation

php 8.0.21
drupal 9.3.16
Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\Core\Path\PathMatcher->matchPath() (line 85 of core/lib/Drupal/Core/Path/PathMatcher.php).
Deprecated function: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\Component\Plugin\PluginBase->getDerivativeId() (line 83 of core/lib/Drupal/Component/Plugin/PluginBase.php).
I think this notice need to be fixed.

Steps to reproduce

upgrade php from 7.4 to 8.0

Proposed resolution

convert param to string type

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component
PathΒ  β†’

Last updated 6 days ago

  • Maintained by
  • πŸ‡¬πŸ‡§United Kingdom @catch
Created by

πŸ‡¨πŸ‡³China Omega_yang

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France mchamps FinistΓ¨re

    Same issue with Drupal 9.5.2 - PHP 8.0.25
    when I run drush

    PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients//vendor/drush/drush/src/internal-forks/Config/Yaml/Inline.php on line 86
    
    Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients//vendor/drush/drush/src/internal-forks/Config/Yaml/Inline.php on line 86
    PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients//vendor/drush/drush/src/internal-forks/Config/Yaml/Inline.php on line 86
    
    Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients//vendor/drush/drush/src/internal-forks/Config/Yaml/Inline.php on line 86
    PHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients//vendor/drush/drush/src/internal-forks/Config/Yaml/Inline.php on line 86
    
    Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/clients//vendor/drush/drush/src/internal-forks/Config/Yaml/Inline.php on line 86
    PHP Deprecated:  Return type of DrushBatchContext::offsetSet($name, $value) should either be compatible with ArrayObject::offsetSet(mixed $key, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/clients//vendor/drush/drush/includes/batch.inc on line 41
    
    Deprecated: Return type of DrushBatchContext::offsetSet($name, $value) should either be compatible with ArrayObject::offsetSet(mixed $key, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/clients//vendor/drush/drush/includes/batch.inc on line 41
    PHP Deprecated:  preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    
    Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    PHP Deprecated:  preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    
    Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    PHP Deprecated:  preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    
    Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    PHP Deprecated:  preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    
    Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    PHP Deprecated:  preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
    
    Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/clients//vendor/consolidation/site-alias/src/SiteSpecParser.php on line 144
     [success] Cache rebuild complete.
    
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Environment: PHP 8.1 & MariaDB 10.3.22
    last update about 1 year ago
    Custom Commands Failed
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Is anyone able to reproduce this in D10 with php8.1+

  • πŸ‡¬πŸ‡§United Kingdom ice70

    Hi,
    yes, I have just got this locally on Drupal 10.2.3 / php 8.1.26

    Went to edit a page: /node/NID/edit
    The content type has a single link field and these notices were repeated for a total of 4 times.

    But, this did seem to happen after enabling workspaces. When I uninstalled workspaces the errors did not show. BUT, I have used workspaces on other 10.2.3 sites which have not generated these error notices.

    Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Drupal\Core\Url::fromUri() (line 281 of core\lib\Drupal\Core\Url.php).
    Drupal\Core\Url::fromUri(NULL, Array) (Line: 175)
    Drupal\link\Plugin\Field\FieldType\LinkItem->getUrl() (Line: 27)
    Drupal\link\Plugin\Validation\Constraint\LinkTypeConstraintValidator->validate(Object, Object) (Line: 202)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(Object, '00000000000006d10000000000000000', Array) (Line: 154)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 106)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 93)
    Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 132)
    Drupal\Core\TypedData\TypedData->validate() (Line: 518)
    Drupal\Core\Entity\ContentEntityBase->validate() (Line: 279)
    Drupal\workspaces\EntityOperations->entityFormAlter(Array, Object, 'node_publications_edit_form') (Line: 64)
    workspaces_form_alter(Array, Object, 'node_publications_edit_form') (Line: 545)
    Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_publications_edit_form') (Line: 841)
    Drupal\Core\Form\FormBuilder->prepareForm('node_publications_edit_form', Array, Object) (Line: 284)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
    Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 49)
    Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
    
    Deprecated function: parse_url(): Passing null to parameter #1 ($url) of type string is deprecated in Drupal\Core\Url::fromUri() (line 284 of core\lib\Drupal\Core\Url.php).
    Drupal\Core\Url::fromUri(NULL, Array) (Line: 175)
    Drupal\link\Plugin\Field\FieldType\LinkItem->getUrl() (Line: 27)
    Drupal\link\Plugin\Validation\Constraint\LinkTypeConstraintValidator->validate(Object, Object) (Line: 202)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(Object, '00000000000006d10000000000000000', Array) (Line: 154)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 106)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 93)
    Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 132)
    Drupal\Core\TypedData\TypedData->validate() (Line: 518)
    Drupal\Core\Entity\ContentEntityBase->validate() (Line: 279)
    Drupal\workspaces\EntityOperations->entityFormAlter(Array, Object, 'node_publications_edit_form') (Line: 64)
    workspaces_form_alter(Array, Object, 'node_publications_edit_form') (Line: 545)
    Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_publications_edit_form') (Line: 841)
    Drupal\Core\Form\FormBuilder->prepareForm('node_publications_edit_form', Array, Object) (Line: 284)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
    Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 49)
    Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
    Deprecated function: str_starts_with(): Passing null to parameter #1 ($haystack) of type string is deprecated in Drupal\Core\Url::fromUri() (line 289 of core\lib\Drupal\Core\Url.php).
    Drupal\Core\Url::fromUri(NULL, Array) (Line: 175)
    Drupal\link\Plugin\Field\FieldType\LinkItem->getUrl() (Line: 27)
    Drupal\link\Plugin\Validation\Constraint\LinkTypeConstraintValidator->validate(Object, Object) (Line: 202)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(Object, '00000000000006d10000000000000000', Array) (Line: 154)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 106)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 93)
    Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 132)
    Drupal\Core\TypedData\TypedData->validate() (Line: 518)
    Drupal\Core\Entity\ContentEntityBase->validate() (Line: 279)
    Drupal\workspaces\EntityOperations->entityFormAlter(Array, Object, 'node_publications_edit_form') (Line: 64)
    workspaces_form_alter(Array, Object, 'node_publications_edit_form') (Line: 545)
    Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_publications_edit_form') (Line: 841)
    Drupal\Core\Form\FormBuilder->prepareForm('node_publications_edit_form', Array, Object) (Line: 284)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
    Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 49)
    Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Production build 0.69.0 2024