Hi,
I installed magento 2.4.4, and using php8.1, and now I have some problems. I don't know how to fix it.
Something went wrong while deploying static content. See the error log for details. Disabling maintenance mode Command returned non-zero exit code: `/usr/bin/php8.1 -f /var/www/html/bin/magento setup:static-content:deploy -f en_US` root@magento2opensource162onubuntu2004lts-s-4vcpu-8gb-amd-sfo3-01:/var/www/html# php bin/magento setup:static-content:deploy Deploy using quick strategy Error happened during deploy process: Deprecated Functionality: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated in /var/www/html/vendor/magento/framework/View/Asset/PreProcessor/FileNameResolver.php on line 44 Execution time: 0.14391589164734
Hi @Modest,
Greetings!
There is an issue with PHP 8.1. So you need to update the composer root update plugin.
composer require magento/composer-root-update-plugin ~2.0 --no-update.
Hope this will help you!
If solved? Click KUDOS and accept it as the solution.
Thank you
I tried it but it didn't work
/var/www/html# php bin/magento/composer-root-update-plugin ~2.0 --no-update Could not open input file: bin/magento/composer-root-update-plugin
Hey man,
These deprecated errors are really annoying but equally, easy enough to fix.
So in this case it's saying you cannot pass null as the 1st parameter to the pathinfo() method. To fix this, you just need to return an empty string as the parameter if it's null, for example:
$path = null; pathinfo($path); echo $path; // this will trigger the deprecated error as a null value has been passed
update the code to:
$path = null; pathinfo($path ?? ""); // the ?? will take $path value and will convert it to an empty string if it's null echo $path;
The error will now be gone as this satisfies the new rules for PHP 8.1
Hope this helps!
Cheers
Ash
I had the same view you posted with the CSS and JS files not loading by resetting the top-level .htaccess file to match the official GitHub repo, which only contains
RewriteEngine on RewriteCond %{REQUEST_URI} !^/pub/ RewriteCond %{REQUEST_URI} !^/setup/ RewriteCond %{REQUEST_URI} !^/update/ RewriteCond %{REQUEST_URI} !^/dev/ RewriteRule .* /pub/$0 [L] DirectoryIndex index.php
I have the same issue. And it is resolved based on the url https://www.thecoachsmb.com/solved-magento-2-4-4-deprecated-functionality-pathinfo-passing-null-to-p....
This is because my custom theme do not have the folder web/images or the folder is empty.
Hi
You need to replace the below code in the core Magento file for a quick fix.
FilePath: vendor/magento/framework/View/Asset/PreProcessor/FileNameResolver.php
Line No: 44
Thanks
This works for me
Thanks a lot :-)
lets take a look. Please run some commands and provide the output:
(note where i say 'php' you may need to use your longer specified version if you don't have an alias)
a) php bin/magento mo:st
b) php bin/magento mo:st|grep -v ^Magento
c) php -v
d) Are you using a custom theme?
Likely either a module that isn't ready for php 8.1 is firing off ('depreciated functionality') or you have some issue that provides a similar error such as the following "Static content deploy error after upgrading magento 2.4.3-p1 to 2.4.4" <- can google. I'm betting the latter given the sum of the issue.
Remember to test fixes in development not prod, and to version your code for easy reversions)
super bro It worked for me