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

disable require once call #2

Merged
merged 1 commit into from
May 6, 2019
Merged

disable require once call #2

merged 1 commit into from
May 6, 2019

Conversation

glensc
Copy link

@glensc glensc commented Apr 30, 2019

carried from zf1#2

as zend classes are not in include path, any require once call will cause fatal error.

and enabling Zend autoloader causes it to load things from include path (which may be outside vendor/ dir)

as zend classes are not in include path, any require once call will cause fatal error
@falkenhawk falkenhawk merged commit 2a1aa8a into zf1s:master May 6, 2019
@falkenhawk
Copy link
Member

Thank you @glensc !

@glensc
Copy link
Author

glensc commented May 6, 2019

now more important question is how do i use this? will you re-tag last git tag?

@falkenhawk
Copy link
Member

@glensc please simply update your dependency. I've released 1.12.21 and it's already available on packagist.

@glensc
Copy link
Author

glensc commented May 6, 2019

ah. though it's not wise to continue incrementing versions even if the upstream is discontinued... but overwriting tags is even more terrible practice.

@falkenhawk
Copy link
Member

zf1s/zend-validate#2

@glensc
Copy link
Author

glensc commented May 6, 2019

I guess 1.12.20.1 would have been an option too. and I agree 1.13 is too much ;)

@glensc
Copy link
Author

glensc commented May 6, 2019

i've upgraded to zf1s/zend-application, but the outcome is rather weird.

why zf1s/zend-config (1.12.3) or zf1s/zend-application (1.12.11).

i'll continue research and post update here.

$ composer require zf1s/zend-application
Using version ^1.12 for zf1s/zend-application
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 6 installs, 5 updates, 0 removals
  - Updating zf1s/zend-exception (1.12.20 => 1.12.20): Downloading (100%)
  - Installing zf1s/zend-registry (1.12.11): Downloading (100%)
  - Installing zf1s/zend-locale (1.12.3): Downloading (100%)
  - Installing zf1s/zend-xml (1.12.11): Downloading (100%)
  - Installing zf1s/zend-loader (1.12.11): Downloading (100%)
  - Updating zf1s/zend-view (1.12.20 => 1.12.21): Downloading (100%)
  - Updating zf1s/zend-controller (1.12.20 => 1.12.21): Downloading (100%)
  - Updating zf1s/zend-validate (1.12.20 => 1.12.21): Downloading (100%)
  - Updating zf1s/zend-uri (1.12.20 => 1.12.20): Downloading (100%)
  - Installing zf1s/zend-config (1.12.3): Downloading (100%)
  - Installing zf1s/zend-application (1.12.11): Downloading (100%)
Writing lock file
$ composer show | grep zend
zf1/zend-application      1.12.20 Zend Framework 1 Application package
zf1/zend-auth             1.12.20 Zend Framework 1 Auth package
zf1/zend-cache            1.12.20 Zend Framework 1 Cache package
zf1/zend-config           1.12.20 Zend Framework 1 Config package
zf1/zend-console-getopt   1.12.20 Zend Framework 1 Console Getopt package
zf1/zend-db               1.12.20 Zend Framework 1 Db package
zf1/zend-filter           1.12.20 Zend Framework 1 Filter package
zf1/zend-http             1.12.20 Zend Framework 1 Http package
zf1/zend-json             1.12.20 Zend Framework 1 Json package
zf1/zend-layout           1.12.20 Zend Framework 1 Layout package
zf1/zend-loader           1.12.20 Zend Framework 1 Loader package
zf1/zend-locale           1.12.20 Zend Framework 1 Locale package
zf1/zend-log              1.12.20 Zend Framework 1 Log package
zf1/zend-paginator        1.12.20 Zend Framework 1 Paginator package
zf1/zend-registry         1.12.20 Zend Framework 1 Registry package
zf1/zend-server           1.12.20 Zend Framework 1 Server package
zf1/zend-session          1.12.20 Zend Framework 1 Session package
zf1/zend-xml              1.12.20 Zend Framework 1 Xml package
zf1s/zend-application     1.12.11 Zend Framework 1 Application package
zf1s/zend-config          1.12.3  Zend Framework 1 Config package
zf1s/zend-controller      1.12.21 Zend Framework 1 Controller package
zf1s/zend-exception       1.12.20 Zend Framework 1 Exception package
zf1s/zend-loader          1.12.11 Zend Framework 1 Loader package
zf1s/zend-locale          1.12.3  Zend Framework 1 Locale package
zf1s/zend-registry        1.12.11 Zend Framework 1 Registry package
zf1s/zend-uri             1.12.20 Zend Framework 1 Uri package
zf1s/zend-validate        1.12.21 Zend Framework 1 Validate package
zf1s/zend-view            1.12.21 Zend Framework 1 View package
zf1s/zend-xml             1.12.11 Zend Framework 1 Xml package

@falkenhawk
Copy link
Member

@glensc if you are still using zf1/ packages, switch all of them to zf1s/ in your composer.json

@glensc
Copy link
Author

glensc commented May 6, 2019

@falkenhawk but this package provides "replace" keyword, shouldn't it replace the previous package namespace?

@glensc
Copy link
Author

glensc commented May 6, 2019

created gist to play with:

git clone https://gist.github.com/c61fed503fd52ac7f4460e6b62bdba24.git -b v1 zf1s-application
cd zf1s-application
composer install

now:

  1. composer require zf1s/zend-application pulls just zf1s/zend-application (1.12.11). why?
  2. composer require zf1s/zend-application:^1.12.21 install newer, but still keeps duplicate previous packages around
$ composer require zf1s/zend-application:^1.12.21
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 6 updates, 0 removals
  - Updating zf1s/zend-exception (1.12.20 => 1.12.20): Loading from cache
  - Installing zf1s/zend-registry (1.12.11): Loading from cache
  - Installing zf1s/zend-locale (1.12.3): Loading from cache
  - Installing zf1s/zend-xml (1.12.11): Loading from cache
  - Installing zf1s/zend-loader (1.12.11): Loading from cache
  - Updating zf1s/zend-view (1.12.20 => 1.12.21): Loading from cache
  - Updating zf1s/zend-controller (1.12.20 => 1.12.21): Loading from cache
  - Updating zf1s/zend-validate (1.12.20 => 1.12.21): Loading from cache
  - Updating zf1s/zend-uri (1.12.20 => 1.12.20): Loading from cache
  - Installing zf1s/zend-config (1.12.3): Loading from cache
  - Updating zf1s/zend-application (1.12.20 => 1.12.21): Loading from cache
Writing lock file
Generating autoload files

$ composer show |grep zend-
composer: Using 7.1, use PHP_VERSION=7.1 to override PHP version
composer: To update this docker image, run: docker pull gitlab.delfi.net:4567/ed/composer:php-7.1
zf1/zend-cache        1.12.20 Zend Framework 1 Cache package
zf1/zend-config       1.12.20 Zend Framework 1 Config package
zf1/zend-loader       1.12.20 Zend Framework 1 Loader package
zf1/zend-locale       1.12.20 Zend Framework 1 Locale package
zf1/zend-registry     1.12.20 Zend Framework 1 Registry package
zf1/zend-xml          1.12.20 Zend Framework 1 Xml package
zf1s/zend-application 1.12.21 Zend Framework 1 Application package
zf1s/zend-config      1.12.3  Zend Framework 1 Config package
zf1s/zend-controller  1.12.21 Zend Framework 1 Controller package
zf1s/zend-exception   1.12.20 Zend Framework 1 Exception package
zf1s/zend-loader      1.12.11 Zend Framework 1 Loader package
zf1s/zend-locale      1.12.3  Zend Framework 1 Locale package
zf1s/zend-registry    1.12.11 Zend Framework 1 Registry package
zf1s/zend-uri         1.12.20 Zend Framework 1 Uri package
zf1s/zend-validate    1.12.21 Zend Framework 1 Validate package
zf1s/zend-view        1.12.21 Zend Framework 1 View package
zf1s/zend-xml         1.12.11 Zend Framework 1 Xml package

@falkenhawk
Copy link
Member

falkenhawk commented May 6, 2019

I am afraid composer's "replace" option does not work that way. The original package does not know about zf1s. Composer tries to find the latest compatible versions of dependencies between zf1 and zf1s packages - that's why you are getting older versions, because zf1 package does not have any clue about newer versions, nor that it's being "replaced" by an alternative one. Could you replace all zf1 occurrences in your composer.json with zf1s, please? It should work then without issues.

@glensc
Copy link
Author

glensc commented May 6, 2019

i've sent PR to force upper version, not sure why it picks lower version:

that will solve the problem and without having to manually update each package

@glensc
Copy link
Author

glensc commented May 6, 2019

alternatively, you could just drop older tags than 1.12.20, because these do not provide "replace" keyword.

@falkenhawk
Copy link
Member

falkenhawk commented May 6, 2019

1. `composer require zf1s/zend-application` pulls just `zf1s/zend-application (1.12.11)`. why?

Not sure but that's probably a result of confused composer trying to figure out the appropriate version based on already installed packages.

  1. Please note that rm -rf ./vendor && rm composer.lock && composer install afterwards would result in installing zf1s/zend-config (1.12.21), but still zf1s/zend-application (1.12.11), but on the other hand, only zf1/zend-application package is still there, but others are not installed anymore
  2. having both
    "require": {
        "zf1/zend-application": "^1.12",
        "zf1s/zend-application": "^1.12"
    }

is asking for troubles...

Maybe we should not waste any more time for trying to guess composer's resolving mechanisms, but focus on getting zf1s packages to work for you - as you have already started doing that - big thanks for your efforts...

@glensc
Copy link
Author

glensc commented May 6, 2019

I think all internal dependencies should be changed to ^1.12.20 then problem is solved. it doesn't pick older version which doesn't replace old zf1 namespace.

the other alternative suggested is drop older tags:

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

Successfully merging this pull request may close these issues.

2 participants