You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Admin class takes an (maybe) authorised client as it's first argument.
$client = new couchClient(http://username:[email protected]:5984),'myDb');
$admin = new couchAdmin($client);
When the admin class wants to make requests it uses the DSN from $client->dsn(), however the username and password is stripped from the DSN in the __construct of couch class:
// couch.php line 68
$this->dsn = preg_replace('@/+$@','',$dsn);
This means that the DSN used by the admin class will not allow the object to authenticate with the database.
At the moment I am extending the client class as so:
// MyClient.php
public function __construct($dsn, $dbname, $options = array() ) {
parent::__construct($dsn, $dbname, $options);
$this->dsn = $dsn;
}
This allows any admin classes to use the 'original' DSN, and thus authenticate.
Am I misunderstanding how this should be used or is this an error?
The text was updated successfully, but these errors were encountered:
The Admin class takes an (maybe) authorised client as it's first argument.
When the admin class wants to make requests it uses the DSN from $client->dsn(), however the username and password is stripped from the DSN in the
__construct
ofcouch
class:This means that the DSN used by the admin class will not allow the object to authenticate with the database.
At the moment I am extending the client class as so:
This allows any admin classes to use the 'original' DSN, and thus authenticate.
Am I misunderstanding how this should be used or is this an error?
The text was updated successfully, but these errors were encountered: