Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated

Created on 9 March 2022, over 2 years ago
Updated 8 September 2024, 2 months ago

Problem/Motivation

after upgrade to php 8.1 with core 9.3.7
i've got the following error due to deprecated null input value

Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of /var/www/subsite/web/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php)
#0 /var/www/subsite/web/core/includes/bootstrap.inc(346): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /var/www/subsite/web/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php(85): dirname()
#3 /var/www/subsite/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php(123): Drupal\Core\Extension\ExtensionPathResolver->getPath()
#4 /var/www/subsite/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(87): Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension()
#5 /var/www/subsite/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(66): Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions()
#6 /var/www/subsite/web/core/lib/Drupal/Core/Cache/CacheCollector.php(149): Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss()
#7 /var/www/subsite/web/core/lib/Drupal/Core/Asset/LibraryDiscovery.php(44): Drupal\Core\Cache\CacheCollector->get()
#8 /var/www/subsite/web/core/lib/Drupal/Core/Asset/LibraryDiscovery.php(58): Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension()
#9 /var/www/subsite/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(68): Drupal\Core\Asset\LibraryDiscovery->getLibraryByName()
#10 /var/www/subsite/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(70): Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies()
#11 /var/www/subsite/web/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(41): Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies()
#12 /var/www/subsite/web/core/lib/Drupal/Core/Asset/AssetResolver.php(104): Drupal\Core\Asset\LibraryDependencyResolver->getLibrariesWithDependencies()
#13 /var/www/subsite/web/core/lib/Drupal/Core/Asset/AssetResolver.php(116): Drupal\Core\Asset\AssetResolver->getLibrariesToLoad()
#14 /var/www/subsite/web/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(312): Drupal\Core\Asset\AssetResolver->getCssAssets()
#15 /var/www/subsite/web/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(158): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries()
#16 /var/www/subsite/web/core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php(45): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments()
#17 [internal function]: Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond()
#18 /var/www/subsite/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#19 /var/www/subsite/vendor/symfony/http-kernel/HttpKernel.php(191): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#20 /var/www/subsite/vendor/symfony/http-kernel/HttpKernel.php(179): Symfony\Component\HttpKernel\HttpKernel->filterResponse()
#21 /var/www/subsite/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#22 /var/www/subsite/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#23 /var/www/subsite/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#24 /var/www/subsite/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#25 /var/www/subsite/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#26 /var/www/subsite/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#27 /var/www/subsite/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#28 /var/www/subsite/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#29 /var/www/subsite/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#30 /var/www/subsite/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#31 {main}

Steps to reproduce

upgrade to php 8.1 with core 9.3.7

Proposed resolution

handling dirname function to accept null value or replace null with empty string

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Postponed: needs info

Version

11.0 ๐Ÿ”ฅ

Component
Otherย  โ†’

Last updated about 5 hours ago

Created by

๐Ÿ‡ช๐Ÿ‡ฌEgypt Mok7tar Egypt , Mansoura

Live updates comments and jobs are added and updated live.
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.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ankitv18

    W.r.t comment #21, I've encountered Error Message 2 while using Site Studio 7.0.x

    Drupal version: 10.0.2
    Site Studio: 7.0.0
    CKEditor 5
    PHP: 8.1.11

  • ๐Ÿ‡ช๐Ÿ‡ธSpain jmohino

    I have the same error with jquery_ui_draggable, line 63 in file ExtensionPathResolver.php. You would also have to change line 58 of the file in the patch:

    -return $this->extensionLists[$type]->getPathname($name);
    +return $this->extensionLists[$type]->getPathname($name ?? '');

    User warning: The following theme is missing from the file system: jquery_ui_draggable en Drupal\Core\Extension\ExtensionPathResolver->getPathname() (lรญnea 63 de /var/www/html/miguelturra/web/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php)

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance aiphes

    Hello,

    After enabled , I get this error too:

    >  [success] Successfully enabled: jquery_ui_draggable
    $ drush @sited9pf pml --filter=drag
     ----------- ------------------------------------------- ---------- ---------
      Package     Name                                        Status     Version
      jQuery UI   jQuery UI Draggable (jquery_ui_draggable)   Enabled    8.x-1.5
    

    Result on:
    Deprecated function : dirname(): Passing null to parameter #1 ($path) of type string is deprecated dans Drupal\Core\Extension\ExtensionPathResolver->getPath() (/home/xxx/www/xxx/sited9/web/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php ligne 85)

    D953 + PHP 8.1.6

    Thanks

  • Status changed to Postponed: needs info over 1 year ago
  • We need the root cause and verified steps to reproduce that begin with โ€œInstall Drupalโ€ that you have actually reproduced. I think that situation has not changed since comment #11.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance Tritof

    Hello,

    After Upgrading Drupal 9.3 > 9.5 + modules, I had the same double warning issue :

    • User warning: The following theme is missing from the file system: jquery_ui_autocomplete in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
    • Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
    • User warning: The following theme is missing from the file system: jquery_ui_menu in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
    • Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).

    Both modules jquery_ui_autocomplete and jquery_ui_menu were required and downloaded during update without activation ( https://www.drupal.org/project/jquery_ui_autocomplete/issues/3328939 ๐Ÿ› Missing Libraries file? Closed: works as designed ).

    Once the modules activated, all the warnings disappeared, including "Deprecated function: dirname(): Passing null to parameter #1..."

  • ๐Ÿ‡ธ๐Ÿ‡ฐSlovakia lubwn

    I had this error with jquery_ui_slider and indeed as stated in #27 actually downloading the module and enabling it, even when not used anywhere on the website it solved the errors present in dblog / occasionaly presented on frontend.

    I wonder why / how this happens but so far this is a good solution for me.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States loopy1492

    We were getting this error on the reports page. I assume it was actually the admin menu? Not sure. Either way, enabling jquery_ui_menu did the trick. Not sure why updb never enabled the module for us if it was suddenly required for some functionality to work.

    Both of these errors were on...
    Location /admin/reports/updates
    Referrer /admin/reports

    Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of /var/www/docroot/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php)
    #0 /var/www/docroot/core/includes/bootstrap.inc(347): _drupal_error_handler_real(8192, 'dirname(): Pass...', '/var/www/docroo...', 85)
    #1 [internal function]: _drupal_error_handler(8192, 'dirname(): Pass...', '/var/www/docroo...', 85)
    #2 /var/www/docroot/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php(85): dirname(NULL)
    #3 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php(135): Drupal\Core\Extension\ExtensionPathResolver->getPath('theme', 'jquery_ui_menu')
    #4 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(87): Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension('jquery_ui_menu')
    #5 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(66): Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions('jquery_ui_menu')
    #6 /var/www/docroot/core/lib/Drupal/Core/Cache/CacheCollector.php(149): Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss('jquery_ui_menu')
    #7 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscovery.php(44): Drupal\Core\Cache\CacheCollector->get('jquery_ui_menu')
    #8 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscovery.php(58): Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension('jquery_ui_menu')
    #9 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(68): Drupal\Core\Asset\LibraryDiscovery->getLibraryByName('jquery_ui_menu', 'menu')

    User warning: The following theme is missing from the file system: jquery_ui_menu in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of /var/www/docroot/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php)
    #0 /var/www/docroot/core/includes/bootstrap.inc(347): _drupal_error_handler_real(512, 'The following t...', '/var/www/docroo...', 63)
    #1 [internal function]: _drupal_error_handler(512, 'The following t...', '/var/www/docroo...', 63)
    #2 /var/www/docroot/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php(63): trigger_error('The following t...', 512)
    #3 /var/www/docroot/core/lib/Drupal/Core/Extension/ExtensionPathResolver.php(85): Drupal\Core\Extension\ExtensionPathResolver->getPathname('theme', 'jquery_ui_menu')
    #4 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php(135): Drupal\Core\Extension\ExtensionPathResolver->getPath('theme', 'jquery_ui_menu')
    #5 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(87): Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension('jquery_ui_menu')
    #6 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php(66): Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions('jquery_ui_menu')
    #7 /var/www/docroot/core/lib/Drupal/Core/Cache/CacheCollector.php(149): Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss('jquery_ui_menu')
    #8 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscovery.php(44): Drupal\Core\Cache\CacheCollector->get('jquery_ui_menu')
    #9 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDiscovery.php(58): Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension('jquery_ui_menu')
    #10 /var/www/docroot/core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php(68): Drupal\Core\Asset\LibraryDiscovery->getLibraryByName('jquery_ui_menu', 'menu')

  • ๐Ÿ‡ช๐Ÿ‡จEcuador jwilson3

    We're getting this error message when testing Drupal 9 with Site Studio 7, where we have not yet enabled CKeditor 5 module (because we're not on Drupal 10 yet).

    Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
    
    Drupal\Core\Extension\ExtensionPathResolver->getPath('theme', 'ckeditor5') (Line: 135) Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension('ckeditor5') (Line: 87) Drupal\Core\Asset\LibraryDiscoveryCollector->getLibraryDefinitions('ckeditor5') (Line: 66) Drupal\Core\Asset\LibraryDiscoveryCollector->resolveCacheMiss('ckeditor5') (Line: 149) Drupal\Core\Cache\CacheCollector->get('ckeditor5') (Line: 44) Drupal\Core\Asset\LibraryDiscovery->getLibrariesByExtension('ckeditor5') (Line: 58) Drupal\Core\Asset\LibraryDiscovery->getLibraryByName('ckeditor5', 'internal.drupal.ckeditor5') (Line: 68) Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies(Array, Array) (Line: 70) Drupal\Core\Asset\LibraryDependencyResolver->doGetDependencies(Array) (Line: 41) Drupal\Core\Asset\LibraryDependencyResolver->getLibrariesWithDependencies(Array) (Line: 104) Drupal\Core\Asset\AssetResolver->getLibrariesToLoad(Object) (Line: 116) Drupal\Core\Asset\AssetResolver->getCssAssets(Object, 1) (Line: 311) Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 157) Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 93) Drupal\cohesion\Render\CohesionAttachmentsProcessor->processAttachments(Object) (Line: 45) Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object) call_user_func(Array, Object, 'kernel.response', Object) (Line: 142) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 202) Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 190) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81) 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: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 270) Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 137) Drupal\shield\ShieldMiddleware->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: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    
  • ๐Ÿ‡บ๐Ÿ‡ฆUkraine taraskorpach Lutsk

    Just re-roll the patch for D10.1.x

  • last update about 1 year ago
    Custom Commands Failed
  • last update about 1 year ago
    Custom Commands Failed
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States bwoods

    I ran into this same problem, and it seemed at first if the patch in #31 worked. However, when I looked a little more closely, I realized the actual issue was that my custom theme was calling two libraries that were not actually enabled (one via a module, one via a theme). These calls were outdated, so once I removed, the notice disappeared, even without this patch.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland sokru

    Still an issue with 10.1.7. From production logs I noticed the issue was triggered by wrong query parameter on aggregated css/js assets. Oddly it was adding query parameter &theme=site_b, when the only available theme is site_a. We have two drupal platforms, which are hosted by different vendors, but authentication is done with Samlauth/SSO, which indicates the user was first logged into site_b and then arrived to site_a which caused the wrong query parameter to be generated.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada sagesolutions

    I ran into this issue as well. Turns out I still had

    {{ attach_library('classy/node') }}

    in my twig template files which was causing the issue. The issue disappeared once I removed that line from all my template files.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada smulvih2 Canada ๐Ÿ

    #31 works for my on 10.2.5

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance ericdsd France

    Patch #31 Works on 10.2.7 too
    +1 for RTBC

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands Summit

    Hi, I think this patch is also needed on new drupal 10.3.0.
    After installing that version, this depreciation message occurs.
    Greetings,

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States hungdo

    Rerolling for 10.3

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia chippyjacob

    #31 works for Drupal 10.2

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom andreastkdf

    #38 works on 10.3.1

    +1 for RTBC

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Anybody Porta Westfalica

    @cilefen re #26 is there a related issue in that project or was that fixed in the meantime?
    Eventually related to ๐Ÿ’ฌ The following theme is missing from the file system: jquery_ui_draggable Active ?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States scottsawyer Atlanta

    I had a similar problem with jquery_ui_accordion, library not loading, missing theme extension, passing null to dirname(). I installed the patch, which did not immediately fix the problem. I disabled then re-enabled jquery_ui_accordion, and it started loading the library. I removed the patch and it still works. I think Drupal just needed a brain flush, and now I do too.

    Not sure if this should be committed, but maybe keep it open for visibility?

Production build 0.71.5 2024