Skip to content

Fix error in TLS connection in PHP > 7.1 #60

Description

@deyura
use LdapTools\DomainConfiguration;

// Make sure to set your LDAP options for your Domain Configuration...
$domain = (new DomainConfiguration('example.local'))
    ->setBaseDn('dc=example,dc=local')
    ->setServers(['dc1.example.local', 'dc2.example.local'])
    ->setUsername('foo')
    ->setPassword('secret')
    ->setUseTls(true)
    ->setLdapOptions([
        'LDAP_OPT_X_TLS_CACERTFILE' => '/path/to/ldap-ssl-bundle',
        'LDAP_OPT_X_TLS_REQUIRE_CERT' => LDAP_OPT_X_TLS_HARD,
    ]);

This code in LdapConnection.php generate executions

ldap_set_option($this->connection, LDAP_OPT_X_TLS_CACERTFILE, '/www/users/ldap-ssl-bundle01.crt');
ldap_set_option($this->connection, LDAP_OPT_X_TLS_REQUIRE_CERT, 'LDAP_OPT_X_TLS_HARD');

Because it enviroment variables for > PHP 7.1 right code will be

ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, '/www/users/ldap-ssl-bundle01.crt');
ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, 'LDAP_OPT_X_TLS_HARD');

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions