-
-
Notifications
You must be signed in to change notification settings - Fork 877
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
Connection reuse refactoring to rid of globals #787
Conversation
f0ae796
to
afc933e
Compare
14f54ec
to
e4cedfe
Compare
rebased |
I'll try to take a look either this evening or within the next few days as time permits. Thanks! |
So overall I think it's a good PR! Email me at terrafrost@php.net your PayPal address and I'll PayPal you the money! |
@terrafrost Let's pay after this was merged? |
*/ | ||
public function getResourceId() | ||
{ | ||
return '{' . spl_object_hash($this) . '}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the { } ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the line he added in _parse_path
...
if (preg_match('/^{[a-z0-9]+}$/i', $host)) {
If he doesn't do the curly brackets than localhost
would match the regex and it'd try to re-use a non-existant SSH2::$connections['localhost']
connection.
Here's how you'd do it with libssh2:
<?php
$ssh2 = ssh2_connect('domain.tld');
ssh2_auth_password($ssh2, 'user', 'pass');
$sftp = ssh2_sftp($ssh2);
$arr = scandir("ssh2.sftp://$sftp/home/user/public_html");
print_r($arr);
If you do echo "ssh2.sftp://$sftp/home/user/public_html"
you get ssh2.sftp://Resource id #4/home/user/public_html
.
idk I think {} works..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{}
symbols that should not be in URL according to RFC. Same symbols Symfony2 use for place holders in URL routes. So it should safe us from any conflicts, because otherwise regexp will match all alphanumeric domains.
That works! |
e4cedfe
to
f690d0e
Compare
This fixes #572 ? |
@bantu yes. It was completely removed |
@terrafrost please invest these money into project. I renounce the prize. Thanks you for your honesty. |
Will do - thanks again for the PR!! |
So I think this is good to merge! I can do it but maybe you'd rather do it @bantu ? |
} | ||
|
||
/** | ||
* Return existed connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
existing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@terrafrost I'll take care of it as soon as the outstanding comments are addressed. |
f690d0e
to
70dd67c
Compare
@bantu branch was rebased. Please check fixes according your comments |
👍 Thanks a lot |
…-25$ Connection reuse refactoring to rid of globals * torinaki/remove-global-and-earn-25$: Connection reuse refactoring to rid of globals
Refactoring that was discussed in #786