Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pathinfo(): Argument #1 ($path) must be of type string, null given #34

Closed
Twansparant opened this issue Mar 31, 2022 · 9 comments
Closed

Comments

@Twansparant
Copy link

Hi there,

Since composer versions 2.3+, I'm getting this error when running composer install with gravityforms:

In FileDownloader.php line 439:
                                                                      
  [TypeError]                                                         
  pathinfo(): Argument #1 ($path) must be of type string, null given

Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:439
 pathinfo() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:439
 Composer\Downloader\FileDownloader->getFileName() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:143
 Composer\Downloader\FileDownloader->download() at phar:///usr/local/bin/composer/src/Composer/Downloader/ZipDownloader.php:100
 Composer\Downloader\ZipDownloader->download() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:228
 Composer\Downloader\DownloadManager->Composer\Downloader\{closure}() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:240
 Composer\Downloader\DownloadManager->download() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:105
 Composer\Installer\LibraryInstaller->download() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:353
 Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:282
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:759
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:588
 Composer\Installer->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Installer.php:279
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:241
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1015
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:334
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:83
 require() at /usr/local/bin/composer:29

Any idea what's going on?
Thanks!

@JimJ92120
Copy link

@Twansparant Twansparant
we've been facing same issue
composer-wp-pro-plugins is simply not yet compatible to 2.3.0 (no release done since 7 months and composer had released 2.3.0 this month (yday): https://github.com/composer/composer/releases

a solution would be to rollback to previous composer version (2.1, 2.2 seems to be ok) and wait for junaidbhura to be compatible with 2.3.0

@Twansparant
Copy link
Author

Twansparant commented Mar 31, 2022

Yeah I just rolled back to version 2.2.10 and that just throws a notice instead of an error:

Deprecation Notice: pathinfo(): Passing null to parameter #1 ($path) of type string is deprecated in phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:457

@JimJ92120
Copy link

@Twansparant Twansparant then 2.1 (works on our side)

@Twansparant
Copy link
Author

Twansparant commented Mar 31, 2022

No sorry, I meant 2.2.10 also works for me!

@junaidbhura
Copy link
Owner

Came across this yesterday. Downgraded Composer to 2.2.10 and it worked for me too. I think its because of strict type checking. Will have to take a look.

More info:
https://blog.packagist.com/composer-2-3/
https://github.com/composer/composer/releases/tag/2.3.0

@JimJ92120
Copy link

@junaidbhura i can have a look this week if needed
meanwhile, it might worth updating (or adding a note on) README.md (https://github.com/junaidbhura/composer-wp-pro-plugins/blob/master/README.md?plain=1#L31) until compatible with composer 2.3.0

@arjendejong12
Copy link

I'm also experiencing this problem on composer 2.3.0 and initial debugging (I might be totally wrong tho) shows that the PluginEvents::PRE_FILE_DOWNLOAD event is loaded after it loads the $package->getDistUrl() in the composer/src/Composer/Downloader/FileDownloader.php#L437 getFileName function, which means the distUrl gets changed too late.

@arjendejong12
Copy link

I think I found a solution, add a trailing slash to the "dist" url:

"dist": {
    "type": "zip",
    "url": "https://www.advancedcustomfields.com/"
}, 

The packages will now install like before. The downside is that this requires developers to edit their composer.json file, instead of simply updating this package.

@junaidbhura
Copy link
Owner

Hello All,

Unfortunately it looks like this happens outside of the plugin here: https://github.com/composer/composer/blob/main/src/Composer/Downloader/FileDownloader.php#L439

So as @arjendejong12 pointed out - the solution in this case will be to just add a trailing slash / in the packages' dist URLs. I'm going to close this issue and update the README of this plugin to reflect this.

jeffbyrnes added a commit to abundanthomesma/abundanthousingma.org that referenced this issue Aug 16, 2022
certainlyakey pushed a commit to certainlyakey/lando-wp-site-template that referenced this issue Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants