0

I am trying to implement CakePHP Ldap Authentication following this example but am getting this error:

Strict (2048): Declaration of LdapAuthenticate::getUser() should be compatible with BaseAuthenticate::getUser(CakeRequest $request) [APP\Plugin\Idbroker\Controller\Component\Auth\LdapAuthenticate.php, line 5]

The context of the error is:

App::uses('BaseAuthenticate', 'Controller/Component/Auth');

class LdapAuthenticate extends BaseAuthenticate {
$className = 'LdapAuthenticate'
$parts = array(
    (int) 0 => 'Idbroker',
    (int) 1 => 'Controller/Component/Auth'
)
$plugin = 'Idbroker'
$package = 'Controller/Component/Auth'
$file = ...Plugin\Idbroker\Controller\Component\Auth\LdapAuthenticate.php'
$paths = array(
    (int) 0 => ...Plugin\Idbroker\Controller\Component\Auth\',
    (int) 1 => ...Plugin\Idbroker\Lib\Controller/Component/Auth\',
    (int) 2 => ...Plugin\Idbroker\Controller/Component/Auth\'
)
$pluginPath = 'C:\csvn\www\KMDEV\app\Plugin\Idbroker\'
$normalizedClassName = 'LdapAuthenticate'
$path = '...Plugin\Idbroker\Controller\Component\Auth\'
include '...Plugin\Idbroker\Controller\Component\Auth\LdapAuthenticate.php line 5
App::load() - CORE\Cake\Core\App.php, line 561
spl_autoload_call - [internal], line ??
class_exists - [internal], line ??

I can see that LdapAuthenticate::getUser() does not have the same signature as BaseAuthenticate::getUser(CakeRequest $request) but am too new to PHP and CakePHP to have a clue as to the best way to repair this. The steps in the example seem simple. My only departures from the example were in App/Config/database.php where I changed the contents (host, port, etc.) to match my web server and App/Config/ldap.php where I removed everything except this:

<?php
$config['LDAP']['Db']['Config'] = 'ldap';
$config['LDAP']['User']['Identifier'] = 'samAccountName';

Should the CakePHP 2.0 example I am using work with the current version of CakePHP (2.3.1)? Is there something I have missed? Is there another easier way to get CakePHP Ldap Authentication working?

jacknad
  • 13,483
  • 40
  • 124
  • 194

1 Answers1

1

This is a php strict warning. Update the method signature of the plugin code to match the signature of the method it inherits from the core and the message will be gone.

You could also disable them but this not recommended. The strict warnings exist for a reason. So update the code whenever you see such a warning and your're done. They're easy to fix as well.

Community
  • 1
  • 1
floriank
  • 25,546
  • 9
  • 42
  • 66