Re: com php-src: Added back support for undocummented host:port syntax: ext/ldap/ldap.c ext/ldap/tests/ldap_connect_variation.phpt
| From: | Ferenc Kovacs | Date: | Thu, 19 Nov 2015 08:29:30 +0000 |
| Subject: | Re: com php-src: Added back support for undocummented host:port syntax: ext/ldap/ldap.c ext/ldap/tests/ldap_connect_variation.phpt | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-89909@lists.php.net to get a copy of this message | ||
On Mon, Nov 16, 2015 at 11:18 AM, Derick Rethans <derick@php.net> wrote:
> On Mon, 16 Nov 2015, Côme Bernigaud wrote:
>
> > Commit: 15876e85e59658bfbda3bf0b0c34d56ca503fd2f
> > Author: Côme Bernigaud <mcmic@php.net> Mon, 16 Nov 2015
> 04:50:12 +0100
> > Parents: e5abc53701ba5a9b58dfaba3b59881c9c410a8e7
> > Branches: PHP-5.6
>
> Are you also merging this into PHP-7.0 and master?
>
> cheers,
> Derick
>
>
> >
> > Link:
>
> http://git.php.net/?p=php-src.git;a=commitdiff;h=15876e85e59658bfbda3bf0b0c34d56ca503fd2f
> >
> > Log:
> > Added back support for undocummented host:port syntax
> >
> > Changed paths:
> > M ext/ldap/ldap.c
> > M ext/ldap/tests/ldap_connect_variation.phpt
> >
> >
> > Diff:
> > diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
> > index da8936c..8b66ba4 100644
> > --- a/ext/ldap/ldap.c
> > +++ b/ext/ldap/ldap.c
> > @@ -372,7 +372,12 @@ PHP_FUNCTION(ldap_connect)
> > }
> >
> > url = emalloc(urllen);
> > - snprintf( url, urllen, "ldap://%s:%ld", host ?
> host : "", port );
> > + if (host && (strchr(host, ':') != NULL)) {
> > + /* Legacy support for host:port */
> > + snprintf( url, urllen, "ldap://%s", host );
> > + } else {
> > + snprintf( url, urllen, "ldap://%s:%ld",
> host ? host : "", port );
> > + }
> > }
> >
> > #ifdef LDAP_API_FEATURE_X_OPENLDAP
> > diff --git a/ext/ldap/tests/ldap_connect_variation.phpt
> b/ext/ldap/tests/ldap_connect_variation.phpt
> > index 09b07e7..eaee261 100644
> > --- a/ext/ldap/tests/ldap_connect_variation.phpt
> > +++ b/ext/ldap/tests/ldap_connect_variation.phpt
> > @@ -28,6 +28,10 @@ var_dump($link);
> > // bad hostname (connect should work, not bind)
> > $link = ldap_connect("nonexistent" . $host);
> > var_dump($link);
> > +
> > +// Legacy host:port syntax
> > +$link = ldap_connect("$host:$port");
> > +var_dump($link);
> > ?>
> > ===DONE===
> > --EXPECTF--
> > @@ -36,4 +40,5 @@ resource(%d) of type (ldap link)
> > resource(%d) of type (ldap link)
> > resource(%d) of type (ldap link)
> > resource(%d) of type (ldap link)
> > +resource(%d) of type (ldap link)
> > ===DONE===
> >
> >
> > --
> > PHP CVS Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> http://derickrethans.nl |
> http://xdebug.org
> Like Xdebug? Consider a donation: http://xdebug.org/donate.php
> twitter: @derickr and @xdebug
> Posted with an email client that doesn't mangle email: alpine
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
this was only meant for PHP-5.6, but it seems that this is also present in
PHP-7.0 and master.
Côme, if you did not change your mind then you should revert this commit
(and probably also 391087ed280f86f144ffa5a2b72eeeda3c271743) from PHP-7.0
and merge up the revert commit to master.
in the future if you want to add something on a lower branch you can either
do this (commit lowest branch, merge up, revert the commit in higher
branch, merge up) or use
git merge -s ours to practically discard the content of the commit when
merging up.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu