Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Problem updating with Composer #70

Closed
claytonrcarter opened this issue Jan 4, 2018 · 7 comments
Closed

Problem updating with Composer #70

claytonrcarter opened this issue Jan 4, 2018 · 7 comments

Comments

@claytonrcarter
Copy link

This is probably an issue with how I have things set up (isn't it always?) but updating other packages seems to work fine.

I'm limited to PHP 5.6, so I can't use collect 5.5, and I have to stay with the 5.4 branch. Collect has been working perfectly for months: thank you!

If I install this way, everything works perfectly, but I'm installing only 5.4.0:

$ composer require tightenco/collect:5.4
...
Package operations: 1 install, 0 updates, 0 removals
  - Installing tightenco/collect (v5.4.0): Loading from cache
...

Then, if I try to install ^5.4, then composer simply removes collect (I would expect it to update to 5.4.33 or whatever is latest):

$ composer require tightenco/collect:^5.4
...
Package operations: 0 installs, 0 updates, 1 removal
  - Removing tightenco/collect (v5.4.0)
...

If I install 5.4.33 manually, it works as expected:

$ composer require tightenco/collect:5.4.33
...
Package operations: 1 install, 0 updates, 0 removals
  - Installing tightenco/collect (v5.4.33): Loading from cache
...

If I try a different package, everything works as expected:

$ composer require illuminate/validation:5.4
...
Package operations: 1 install, 0 updates, 0 removals
  - Installing illuminate/validation (v5.4.0): Loading from cache
...
$ composer require illuminate/validation:^5.4
...
Package operations: 0 installs, 1 update, 0 removals
  - Updating illuminate/validation (v5.4.0 => v5.4.36): Loading from cache
...

Any suggestions that might help me figure out what's causing this?

@antonioribeiro
Copy link
Contributor

You have to

composer require tightenco/collect:"5.4.*"

The ^ tells composer to use semantic versioning, so, the next stable version would be 5.5, according to Semver.

@claytonrcarter
Copy link
Author

Thank you, but that doesn't work for me

$ composer require tightenco/collect:"5.4.*"
...
Package operations: 0 installs, 0 updates, 1 removal
  - Removing tightenco/collect (v5.4.0)
...

also, if that's the case, why does it seem to work for the Illuminate packages, but not this one?

@claytonrcarter
Copy link
Author

More fun with version constraints! None of the following seem to work:

$ composer require tightenco/collect:"~5.4.0"
$ composer require tightenco/collect:"~5.4.33"
$ composer require tightenco/collect:"<5.5"

All three of these result in tightenco/collect being removed (if it's been installed) or in "Nothing to install or update" if it hasn't already been installed.

@antonioribeiro
Copy link
Contributor

I confirm there's something odd there, and it is, probably, related to the installation of an Illuminate package which is requiring Illuminate\Support, which has Collection. Currently Tightenco\Collect uses the very same namespace of Illuminate\Collection, which might be causing the glitch. There are some pull requests to change the namespace from Illuminate to Tightenco, but apparently the package maintainers are not yet set on this, because it might have some other implications.

But if you are using one of those (Illuminate) packages, you don't really need Tightenco\Collect, since you will receive Illuminate/Collection, which is supposed to be exactly the same in Tightenco\Collect.

The odd part of it all is that Composer adds the dependency in the composer.json file, but does not download the dependency, so this is probably a bug.

The tests I did:

$ composer require illuminate/validation:"5.4.*"
No composer.json in current directory, do you want to use the one at /Users/antoniocarlosribeiro/code? [Y,n]? n
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 12 installs, 0 updates, 0 removals
  - Installing paragonie/random_compat (v2.0.11): Loading from cache
  - Installing symfony/polyfill-php70 (v1.6.0): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.6.0): Loading from cache
  - Installing symfony/http-foundation (v3.4.2): Loading from cache
  - Installing illuminate/contracts (v5.4.36): Downloading (100%)
  - Installing doctrine/inflector (v1.2.0): Loading from cache
  - Installing illuminate/support (v5.4.36): Downloading (100%)
  - Installing symfony/finder (v3.4.2): Loading from cache
  - Installing illuminate/filesystem (v5.4.36): Downloading (100%)
  - Installing illuminate/translation (v5.4.36): Downloading (100%)
  - Installing illuminate/container (v5.4.36): Downloading (100%)
  - Installing illuminate/validation (v5.4.36): Downloading (100%)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
illuminate/support suggests installing symfony/process (Required to use the composer class (~3.2).)
illuminate/support suggests installing symfony/var-dumper (Required to use the dd function (~3.2).)
illuminate/filesystem suggests installing league/flysystem (Required to use the Flysystem local and FTP drivers (~1.0).)
illuminate/filesystem suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (~1.0).)
illuminate/filesystem suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).)
illuminate/validation suggests installing illuminate/database (Required to use the database presence verifier (5.4.*).)
Writing lock file
Generating autoload files

Then, trying to install Collect doesn't work:

antoniocarlosribeiro at antonios-imac in ~/code/test
$ composer require tightenco/collect:"^5.4"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files

But if you install an Illuminate package which is not requiring Support, it all works fine, like Contracts:

antoniocarlosribeiro at antonios-imac in ~/code/test
$ composer require illuminate/contracts
Using version ^5.5 for illuminate/contracts
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Installing psr/simple-cache (1.0.0): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing illuminate/contracts (v5.5.28): Downloading (100%)
Writing lock file
Generating autoload files

Installing Collect expecting it to download 5.5:

antoniocarlosribeiro at antonios-imac in ~/code/test
$ composer require tightenco/collect:"^5.4"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing tightenco/collect (v5.5.27): Downloading (100%)
tightenco/collect suggests installing symfony/var-dumper (Required to prettify dd() and dump() (~3.3).)
Writing lock file
Generating autoload files

Then downgrading using the proper version constraint:

antoniocarlosribeiro at antonios-imac in ~/code/test
$ composer require tightenco/collect:"5.4.*"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Updating tightenco/collect (v5.5.27 => v5.4.33): Downloading (100%)
Writing lock file
Generating autoload files

@claytonrcarter
Copy link
Author

💡 Aha! Thank you @antonioribeiro. We pulled in illuminate/routing (which depends on illuminate/support) a few months ago and I didn't realize I was getting a duplicate of Collection. This doesn't resolve the issue, but at least I can move on without worrying about it. Thank you for your help!

@huiyonghkw
Copy link

PHP Warning:  Class 'Tightenco\Collect\Support\Debug\Dumper' not found in /Users/huiyong/.composer/vendor/tightenco/collect/src/Collect/Support/alias.php on line 18

Warning: Class 'Tightenco\Collect\Support\Debug\Dumper' not found in /Users/huiyong/.composer/vendor/tightenco/collect/src/Collect/Support/alias.php on line 18
PHP Warning:  Class 'Tightenco\Collect\Support\Debug\HtmlDumper' not found in /Users/huiyong/.composer/vendor/tightenco/collect/src/Collect/Support/alias.php on line 18

Warning: Class 'Tightenco\Collect\Support\Debug\HtmlDumper' not found in /Users/huiyong/.composer/vendor/tightenco/collect/src/Collect/Support/alias.php on line 18

composer global show

tightenco/collect         v5.7.1  Collect - Illuminate Collections as a separate package.

composer global require tightenco/collect:"5.4.*"

fixed problem

@mattstauffer
Copy link
Member

@bravist that’s #124

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants