Skip to content

FIXED: FTP user and password strings urldecoded#16876

Merged
magento-engcom-team merged 2 commits into
magento:2.3-developfrom
javierperezm:patch-2
Jul 21, 2018
Merged

FIXED: FTP user and password strings urldecoded#16876
magento-engcom-team merged 2 commits into
magento:2.3-developfrom
javierperezm:patch-2

Conversation

@javierperezm

Copy link
Copy Markdown
Contributor

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 @javierperezm. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me {$VERSION} instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@osrecio osrecio self-assigned this Jul 17, 2018
@osrecio

osrecio commented Jul 18, 2018

Copy link
Copy Markdown
Member

Hi @javierperezm, Can you check Code Standars error in Travis. The PR looks like OK, but we should solve the problem with Coding Standars before.

recoding to pass travis coding standards
@aleron75 aleron75 self-requested a review July 19, 2018 09:48
@javierperezm

Copy link
Copy Markdown
Contributor Author

@osrecio I don't understand the Travis response... the warnings are placed outside my changes, and even outside the class I patched

@osrecio

osrecio commented Jul 19, 2018

Copy link
Copy Markdown
Member

@javierperezm Now the Travis is green, without Code Standard issues. I will review ASAP.

@magento-engcom-team

Copy link
Copy Markdown
Contributor

@javierperezm thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@magento-engcom-team

Copy link
Copy Markdown
Contributor

Hi @aleron75, thank you for the review.
ENGCOM-2425 has been created to process this Pull Request

@aleron75

Copy link
Copy Markdown
Contributor

Once merged, don't forget you can easily backport this PR to 2.2 with the Porting Tool, read more here.

@magento-engcom-team magento-engcom-team merged commit 3884bac into magento:2.3-develop Jul 21, 2018
@magento-engcom-team

Copy link
Copy Markdown
Contributor

Hi @javierperezm. Thank you for your contribution.
We will aim to release these changes as part of 2.3.0.
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