7

php ver 8.1

Error happened during deploy process: Deprecated Functionality: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated in /vendor/magento/framework/View/Asset/PreProcessor/FileNameResolver.php on line 45

if any person face this error and solved please help to solved this error

2

7 Answers 7

8

Make sure that logo of theme is here app/design/frontend/[Your Vendor]/[Theme Name]/web/images/logo.svg

It is necessary. But I guess it is bug of Magento 2 with PHP 8.1

1
7

The issue has been caused because your custom theme doesn't have a preview image, then PHP 8.1 throws that error due to Magento core logic.

Fix that by adding an image to your custom theme.

For example: app/design/frontend/[Your Vendor]/[Theme Name]/web/images/logo.svg

Magento 2 custom theme image

1
  • Hello @Rafael Corrêa Gomes, Thanks for your reply but i already adding an image to my custom theme Even then the error comes May 19, 2022 at 11:09
2

Worked for me without modifying the vendor/magento/framework/App/Utility/Files.php.

After modifying theme.xml file and adding a preview image. i also added a logo.svg in theme folder/web/images/logo.svg and it worked

    if (!$files) {
                echo $themePackage->getVendor(). '' .  $themePackage->getName().'<br>';
                $result[] = [
                    $themeArea,
                    $themePackage->getVendor() . '/' . $themePackage->getName(),
                    null,
                    null,
                    null,
                    null
                ];
            }

Just add the echo and u can see which theme is creating the issue

1

Backtrace the error

Add the following code in /vendor/magento/framework/View/Asset/PreProcessor/FileNameResolver.php above line 45

if ($fileName === null) { 
    debug_print_backtrace(2); 
    die;
}

For me, the backtrace output was something like this:

#0 vendor/magento/module-deploy/Collector/Collector.php(97): Magento\Framework\View\Asset\PreProcessor\FileNameResolver->resolve(NULL)
#1 vendor/magento/module-deploy/Package/PackagePool.php(183): Magento\Deploy\Collector\Collector->collect()
#2 vendor/magento/module-deploy/Package/PackagePool.php(117): Magento\Deploy\Package\PackagePool->collect()
#3 vendor/magento/module-deploy/Strategy/QuickDeploy.php(54): Magento\Deploy\Package\PackagePool->getPackagesForDeployment(Array)

I had to create the following patch to fix the error:

--- a/vendor/magento/module-deploy/Collector/Collector.php
+++ b/vendor/magento/module-deploy/Collector/Collector.php
@@ -90,7 +90,7 @@
         foreach ($this->sourcePool->getAll() as $source) {
             $files = $source->get();
             foreach ($files as $file) {
-                if ($file->getModule() && !$this->moduleManager->isEnabled($file->getModule())) {
+                if ($file->getModule() && !$this->moduleManager->isEnabled($file->getModule()) || is_null($file->getFileName())) {
                     continue;
                 }
                 $file->setDeployedFileName($this->fileNameResolver->resolve($file->getFileName()));
1
  • Patch worked perfectly, Thanks. for people wondering how to use a patch just nano patch_for_245.patch mylook-upgraded-245 and paste above code there and apply with patch -p1 < patch_for_245.patch Sep 28 at 16:21
0

If the theme is Porto, the following may help:

rm -R ./app/design/frontend/Smartwave/porto_child
0

Solution: –

Go to the parent directory of your theme, it must be in

vendor/magento/theme-magento-blank or theme-magneto-luma/ then web/images, copy logo.svg and put this in your theme directory

app/design/frontend/[vendor]/[theme]/web/images

The problem was we should put the logo.svg image file in our theme:

app/design/frontend/[vendor]/[theme]/web/images/logo.svg

In Magento 2.4.4, Child themes need to have a logo.svg file.

Once you copied logo.svg from parent to your theme. Do the following :

Remove the files and folders present inside pub/static/frontend
Remove the files and folders present inside var/view_preprocessed/pub/static/frontend
Run the deploy command  – php bin/magento s:s:d -f
0

I have deleted theme then getting the same error. When i running the content deploy command.

Deploy using quick strategy Error happened during deploy process: Deprecated Functionality: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated in /vendor/magento/framework/View/Asset/PreProcessor/FileNameResolver.php on line 42

So for this i have added this solution and working fine.

Before

$extension = pathinfo($fileName, PATHINFO_EXTENSION);

After

$extension = pathinfo($fileName ?? "", PATHINFO_EXTENSION);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.