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

Fix incorrect script name when Drupal uses a domain + subdir #3166

Closed
wants to merge 6 commits into from
Closed

Fix incorrect script name when Drupal uses a domain + subdir #3166

wants to merge 6 commits into from

Conversation

Chi-teck
Copy link
Collaborator

@Chi-teck Chi-teck commented Nov 14, 2017

This only happens when Drupal is installed in subdirectory and site URL is passed by means global uri option like follows.
drush <CMD> --uri=http://localhost/subdirectory

Because of wrong script name some Drupal global variables ($base_path and $base_url) get wrong values.

@Chi-teck
Copy link
Collaborator Author

The URLs generated by Drupal core Url class are still wrong though.

@Chi-teck
Copy link
Collaborator Author

Chi-teck commented Nov 14, 2017

The simplest way to reproduce the issue is to put the following code to some command and call it with uri=http://localhost/path/to/drupal/ option.

$this->io()->write((new Url('system.admin'))->toString());

Instead /path/to/drupal/admin it prints /admin.

@weitzman
Copy link
Member

tests are failing, unfortunately.

@weitzman
Copy link
Member

weitzman commented Jan 3, 2018

Still needed?

@Chi-teck
Copy link
Collaborator Author

Chi-teck commented Jan 4, 2018

The bug still exists in master. I am having troubles with setting up SUT. This might be related to my local environment (PHP 7.2).

@greg-1-anderson
Copy link
Member

You must use Drupal 8.4.4 (release yesterday) if you are using PHP 7.2. Earlier versions did not support 7.2.

@Chi-teck
Copy link
Collaborator Author

Chi-teck commented Jan 4, 2018

I am using the latest code form 8.5.x Git branch. Is Drush itself compatible with PHP 7.1 and PHP 7.2? It appears it is not tested against these PHP versions.
https://github.com/drush-ops/drush/blob/master/.travis.yml#L11

@weitzman weitzman changed the title Fix incorrect script name Fix incorrect script name whn Drupal a domain + subdir Feb 12, 2018
@weitzman weitzman changed the title Fix incorrect script name whn Drupal a domain + subdir Fix incorrect script name when Drupal uses a domain + subdir Feb 12, 2018
@hansfn
Copy link
Contributor

hansfn commented Feb 12, 2018

Since this issue most likely is the cause for the missing subdir when using drush uli with uri option, I'm adding it here so other people can find it:

drush uli --no-browser --uri=http://nonexisting.domain/folder

returns "http://nonexisting.domain/user/reset/1/[...]" without the subdir in the URL (when using Drush 9.1.0).

@ao2
Copy link

ao2 commented Mar 23, 2018

Some other commands to reproduce the issue are in #3463

@Chi-teck can you rebase your branch on the latest drush version so that we can validate your changes and go forward with this issue?

Thanks,
Antonio

@weitzman
Copy link
Member

Github updated the PR so its up to date with master. Still is failing tests tho.

@weitzman
Copy link
Member

FYI #3553 just fixed this.

@ao2
Copy link

ao2 commented May 15, 2018

Thanks @weitzman

@gitressa
Copy link
Contributor

gitressa commented Oct 10, 2018

It works for sub-directories, if there is a trailing slash:

No trailing slash, subdir not included:

$ drush uli --uri=http://nonexisting.domain/folder
http://nonexisting.domain/user/reset/1/153...uPBiz5lA/login

With trailing slash, subdir is included:

$ drush uli --uri=http://nonexisting.domain/folder/
http://nonexisting.domain/folder/user/reset/1/1539196592/tMD_...If7mKyRvQ/login

rmuit added a commit to rmuit/drush that referenced this pull request Jan 6, 2019
rmuit added a commit to rmuit/drush that referenced this pull request Jan 7, 2019
rmuit added a commit to rmuit/drush that referenced this pull request Feb 19, 2019
weitzman pushed a commit that referenced this pull request Feb 28, 2019
…without scheme. (#3847)

* Continue #3166/2. Fix incorrect script name when Drupal uses a domain + subdir without scheme.

* Do not append the slash to $this->uri. (Nothing indicates this is needed.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants