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

Issue fork drupal-3268634

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Mok7tar created an issue. See original summary.

longwave’s picture

The NULL in question is returned by ExtensionPathResolver::getPathname()

    return dirname($this->getPathname($type, $name));

This should only return NULL in two cases:

      @trigger_error('Calling getPathname() with an invalid $type parameter is deprecated in drupal:9.3.0 and will throw an \Drupal\Core\Extension\Exception\UnknownExtensionTypeException in drupal:10.0.0. See https://www.drupal.org/node/2940438', E_USER_DEPRECATED);
      return NULL;

or

      trigger_error(sprintf('The following %s is missing from the file system: %s', $type, $name), E_USER_WARNING);
      return NULL;

Which of these errors was triggered in your case?

mok7tar’s picture

i think it first case

anprok’s picture

Status: Active » Reviewed & tested by the community

Helped me with error message on php 8.1 and core 9.3.11

Status: Reviewed & tested by the community » Needs work

The last submitted patch, core_dirname.patch, failed testing. View results

andregp’s picture

Status: Needs work » Reviewed & tested by the community

I believe the test fail was random, restoring status...

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, core_dirname.patch, failed testing. View results

anprok’s picture

Status: Needs work » Needs review
longwave’s picture

I don't believe forcing an empty string to be passed is the right fix. Instead we should figure out why these functions are being called with NULL in the first place, as that seems like the real bug.

I also think in cases like this we should consider introducing typed parameters on the methods in question, which should raise a TypeError closer to the source of the problem.

Christopher Riley’s picture

Should this patch apply cleanly on Drupal 9.4.1 because I am seeing a fail when I do the composer patch.

anprok’s picture

You can use this patch from merge request in Drupal 9.4.x https://git.drupalcode.org/project/drupal/-/merge_requests/2474.diff

larowlan’s picture

You can use this patch from merge request in Drupal 9.4.x https://git.drupalcode.org/project/drupal/-/merge_requests/2474.diff

PSA don't use this URL directly, as anyone can push to that branch you're opening your project up to supply chain attacks. Instead wget the patch and store it in your repo and reference the file instead from composer patches.

robcarr’s picture

The patch applies to 9.4.5.

Not an expert on collateral issues in core, but sorted my problem out running site under PHP 8.1.8

RTBC?

eduardo morales alberti’s picture

As longwave says, the steps to reproduce the error should be more clear to know why the params are null when should not be NULL.

I saw multiple fixes like this one (convert to string NULL values) and I think is a "workaround" to silence the warnings, but not a solution to the problem.

gordon’s picture

Status: Needs review » Needs work

I had this issue for a client site. But this was a secondary issue which was caused by a bug earlier on.

We should not be just setting the NULL to '' to just obfuscate the real issue. If you are getting these errors it is because you have an issue. Maybe a @longwave put it to add in some triggering errors would be a better idea as I see in the future as more people move to PHP 8.1, they will turn off the depreciated errors and just ignore this issue.

ravi.shankar made their first commit to this issue’s fork.

ravi.shankar’s picture

Rebased the current MR, keeping the status needs work for comment #17

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

sophron’s picture

Drupal Version: 9.5.2 | PHP Version:8.1.13

Steps to Reproduce the Error

  1. Delete All Errors in Recent Logs
  2. Clear Cache
  3. Click Structure
  4. Click Webforms
  5. or directly to /admin/structure/webform

Error Message 1: 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).

Error message 2: User warning: The following theme is missing from the file system: ckeditor in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).

ankitv18’s picture

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

jmohino’s picture

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)

aiphes’s picture

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

cilefen’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

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.

cilefen’s picture

tritof’s picture

Hello,

After Upgrading Drupal 9.3 > 9.5 + modules (PHP 8.1.13), 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).

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

lubwn’s picture

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.

loopy1492’s picture

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.

We are on PHP 8.1 and Core 9.5.5.

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')

jwilson3’s picture

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)
taraskorpach’s picture

StatusFileSize
new14.86 KB

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

bwoods’s picture

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.

sokru’s picture

Version: 9.5.x-dev » 11.x-dev

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.

sagesolutions’s picture

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.

smulvih2’s picture

#31 works for my on 10.2.5

ericdsd’s picture

Patch #31 Works on 10.2.7 too
+1 for RTBC

summit’s picture

Hi, I think this patch is also needed on new drupal 10.3.0.
After installing that version, this depreciation message occurs.
Made issue for drupal 10.3 on https://www.drupal.org/project/drupal/issues/3457370
Greetings,

hungdo’s picture

StatusFileSize
new2.09 KB

Rerolling for 10.3

chippyjacob’s picture

#31 works for Drupal 10.2

andreastkdf’s picture

#38 works on 10.3.1

+1 for RTBC

anybody’s picture

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

scottsawyer’s picture

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?

firewaller’s picture

+1

eduardo morales alberti’s picture

Status: Postponed (maintainer needs more info) » Needs work

The problem is that the library does not exist because it was removed or is not loaded properly, so it should be captured and trigger a warning indicating what library is failing instead of the current Deprecated function: dirname() message.

drale01’s picture

I had the same issue with my custom theme, and the error disappeared after I removed a non-existent library reference.

Fix for my issue

firewaller’s picture

We've been seeing this issue for months since the upgrade. There is no indication of which module or library is being incorrectly called, so I agree with @eduardo-morales-alberti that the messaging needs to be updated or a separate log needs to be added. Is there any tool or mechanism for identifying the incorrect module or library?

firewaller’s picture

Status: Needs work » Needs review
StatusFileSize
new14.98 KB

I just realized that patch #38 wasn't a complete reroll of the previously working patch for #31. I've rerolled #31 for 10.3

This should just bypass the warning, but it doesn't resolve the underlying issue which I think should be addressed in this issue or a followup issue.

smustgrave’s picture

Status: Needs review » Needs work

Steps still appear to be missing from summary.

Not sure we should be putting empty checks on every call. We should research which spot is causing the problem and backtrace why the value is null. So we aren’t masking a different issue

firewaller’s picture

I agree actually. I don't want to cover the issue up. I just wanted to fix the partial reroll from #38, but I'm all ears for suggestions to identify these invalid modules/libraries.

gold’s picture

I was just going to update the description with the steps to reproduce from #21 and I note that both #21 and #22 list contrib modules.

Is it possible to replicate this issue with a clean install of Drupal Core alone?

kartagis’s picture

In regard to #21, I am getting both the errors only when I install my webform related custom module. UPDATE: It seems that I was getting the error because of a typo. I corrected that typo and I'm now getting a warning.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

vladimiraus’s picture

StatusFileSize
new733 bytes

Updated patch for 10.6

vladimiraus’s picture

Status: Needs work » Needs review
StatusFileSize
new737 bytes

D11.3 patch

sivaji_ganesh_jojodae’s picture

Status: Needs review » Needs work

The issue summary indicates the version as main, while the merge request targets the 9.4.x branch. Am I missing something here?

Additionally, according to the contribution policy, code changes should be submitted through a merge request rather than patches.

andreastkdf changed the visibility of the branch main to hidden.

andreastkdf’s picture

Status: Needs work » Needs review

Updated the fork with main branch from upstream and opened a new MR from new branch 3268634-deprecated-function-dirname-main-branch and targeting main, including the fix.

smustgrave’s picture

Status: Needs review » Needs work

Thanks but this ticket also needs updated steps to reproduce this. Depending on that will probably determine if we need test coverage

andreastkdf’s picture

btw, I updated the method definitions as file could be NULL on loadFile (case when css_asset['data'] does not exist)

andreastkdf’s picture

@smustgrave, about your re-#59:

I opened the MR mainly to refresh the patch against latest core.

However, after looking at it more closely, I do not think this is the right fix. Making loadFile() accept NULL and changing dirname($file) to dirname($file ?? '') just suppresses the deprecation when $file is unexpectedly NULL.

From the comments above, it looks like the real issue is usually upstream: Drupal is trying to resolve a library or extension that does not actually exist, for example, because of an invalid library definition, outdated theme reference, or missing contrib/module code.

The patches and direction on this issue do not address the underlying problem, since $file is still then passed to file_get_contents() and $base_path is derived from a non-path value. In other words, this masks the symptom rather than fixing where the invalid input originates.

smustgrave’s picture

Excellent investigative work! We 100% want to address the problem and not mask it.