Skip to content

[Backport] FIXED: FTP user and password strings urldecoded#17247

Merged
magento-engcom-team merged 2 commits into
magento:2.1-developfrom
mage2pratik:2.1-develop-PR-port-16876
Jul 31, 2018
Merged

[Backport] FIXED: FTP user and password strings urldecoded#17247
magento-engcom-team merged 2 commits into
magento:2.1-developfrom
mage2pratik:2.1-develop-PR-port-16876

Conversation

@mage2pratik

Copy link
Copy Markdown
Contributor

Original Pull Request

#16876

Description

FTP connections can't use user or password strings with special characters, like @ or #.
$user = 'my@mail.com';
$pass = '#my@pass';
$host = 'ftphost.com';
$ftp->connect("ftp://{$user}:{$pass}@{$host}");

connect() calls parse_url() and this will break down bad the special chars...

Solution:
// ...
$user = urlencode($user);
$pass = urlencode($pass);
$ftp->connect( ... );

But connect() method calls ftp_login() without decode the $user and $pass vars

Manual testing scenarios

  1. $ftp->connect("ftp://my%23mail.com:mypass@myhost.com"); // this works
  2. $ftp->connect("ftp://no_special_chars:mypass@myhost.com"); // this works too

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team

Copy link
Copy Markdown
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-2569 has been created to process this Pull Request

@magento-engcom-team

Copy link
Copy Markdown
Contributor

Hi @mage2pratik. Thank you for your contribution.
We will aim to release these changes as part of 2.1.15.
Please check the release notes for final confirmation.

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.

4 participants