magento / magento-cloud

Magento Cloud
Open Software License 3.0
206 stars 237 forks source link

Magento Cloud 2.4.4 fresh install failure #528

Closed lagunacellar closed 2 years ago

lagunacellar commented 2 years ago

When installing Magento Cloud 2.4.4 on local server, ran into this error when running $ bin/magento setup:static-content:deploy -f

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/beta/vendor/magento/framework/View/Asset/PreProcessor/FileNameResolver.php on line 44

When installing 2.4.4 on Magento Cloud, ran into a related error:

[2022-04-16T23:14:40.417807+00:00] ERROR: [19] The command "php ./bin/magento setup:static-content:deploy --ansi --no-interaction -f --jobs 4 --no-html-minify en_US" failed. Error happened during deploy process: Deprecated Functionality: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated in /app/vendor/magento/framework/View/Asset/PreProcessor/FileNameResolver.php on line 44
W: 
W: In Processor.php line 129:
W:                                                                                
W:   The command "php ./bin/magento setup:static-content:deploy --ansi --no-inte  
W:   raction -f --jobs 4 --no-html-minify en_US" failed. Error happened   
W:   during deploy process: Deprecated Functionality: pathinfo(): Passing null t  
W:   o parameter #1 ($path) of type string is deprecated in /app/vendor/magento/  
W:   framework/View/Asset/PreProcessor/FileNameResolver.php on line 44    
W:                                                                                
W: 
W: In Generate.php line 98:
W:                                                                                
W:   The command "php ./bin/magento setup:static-content:deploy --ansi --no-inte  
W:   raction -f --jobs 4 --no-html-minify en_US" failed. Error happened   
W:   during deploy process: Deprecated Functionality: pathinfo(): Passing null t  
W:   o parameter #1 ($path) of type string is deprecated in /app/vendor/magento/  
W:   framework/View/Asset/PreProcessor/FileNameResolver.php on line 44    
W:                                                                                
W: 
W: In Shell.php line 86:
W:                                                                                
W:   The command "php ./bin/magento setup:static-content:deploy --ansi --no-inte  
W:   raction -f --jobs 4 --no-html-minify en_US" failed. Error happened   
W:   during deploy process: Deprecated Functionality: pathinfo(): Passing null t  
W:   o parameter #1 ($path) of type string is deprecated in /app/vendor/magento/  
W:   framework/View/Asset/PreProcessor/FileNameResolver.php on line 44    
W:                                                                                
W: 
W: run <scenario>...
W: 

E: Error building project: Step failed with status code 19.

E: Error: Unable to build application, aborting.

lagunacellar commented 2 years ago

The culprit: /var/www/beta/vendor/magento/framework/View/Asset/PreProcessor/FileNameResolver.php
The solution: ???

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Framework\View\Asset\PreProcessor;

/**
 * Class FileNameResolver
 *
 * @package Magento\Framework\View\Asset\PreProcessor
 */
class FileNameResolver
{
    /**
     * @var AlternativeSource[]
     */
    private $alternativeSources;

    /**
     * FileNameResolver constructor.
     * @param array $alternativeSources
     * @internal param AlternativeSource $alternativeSource
     */
    public function __construct(array $alternativeSources = [])
    {
        $this->alternativeSources = array_map(
            function (AlternativeSourceInterface $alternativeSource) {
                return $alternativeSource;
            },
            $alternativeSources
        );
    }

    /**
     * Resolve filename
     *
     * @param string $fileName
     * @return string
     */
    public function resolve($fileName)
    {
        $compiledFile = $fileName;
        $extension = pathinfo($fileName, PATHINFO_EXTENSION);
        foreach ($this->alternativeSources as $name => $alternative) {
            if ($alternative->isExtensionSupported($extension)
                && strpos(basename($fileName), '_') !== 0
            ) {
                $compiledFile = substr($fileName, 0, strlen($fileName) - strlen($extension) - 1);
                $compiledFile = $compiledFile . '.' . $name;
            }
        }
        return $compiledFile;
    }
}