mattv8 / yourls-ldap-plugin

Simple LDAP plugin for YOURLS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash after activating plugin immediately

abdennour opened this issue · comments

i am getting this error

Fatal error: Uncaught TypeError: array_merge(): Argument #2 must be of type array, bool given in 
/var/www/html/user/plugins/yourls-ldap-plugin/plugin.php:286 Stack trace: #0 /var/www/html/user/plugins/yourls-ldap-plugin/plugin.php(286):  array_merge(Array, false)
 #1 /var/www/html/includes/functions-plugins.php(232): ldapauth_merge_users(Array) 
#2 /var/www/html/includes/functions-plugins.php(282): yourls_apply_filter('plugins_loaded', Array, true)
 #3 /var/www/html/includes/Config/Init.php(108): yourls_do_action('plugins_loaded') 
#4 /var/www/html/includes/load-yourls.php(26): YOURLS\Config\Init->__construct(Object(YOURLS\Config\InitDefaults)) 
#5 /var/www/html/admin/index.php(3): require_once('/var/www/html/i...') 
#6 {main} thrown in /var/www/html/user/plugins/yourls-ldap-plugin/plugin.php on line 286

note that user/config.php has been organized to accept values from env vars:

/* configuration for 'yourls-ldap-plugin' */

/**
 * LDAP host name, IP or URL. You can use ldaps://host for LDAP with TLS
 */
define( 'LDAPAUTH_HOST', getenv('LDAPAUTH_HOST') ?: 'ldaps://ldap.example.com' );
/**
 * LDAP server port - often 389 or 636 for TLS (LDAPS)
 */
define( 'LDAPAUTH_PORT', getenv('LDAPAUTH_PORT') ?: '636' );
/**
 * Base DN (location of users)
 */
define( 'LDAPAUTH_BASE', getenv('LDAPAUTH_BASE') ?: 'dc=example,dc=com' );
/**
 * (optional) LDAP field name in which username is store
 */
define( 'LDAPAUTH_USERNAME_FIELD', getenv('LDAPAUTH_USERNAME_FIELD') ?: 'uid');

/**
 * (optional) Defaults to 1, which caches users in the options table.
 * 0 turns off cacheing.
 * Other values are currently undefined, but may be one day
 */
define( 'LDAPAUTH_USERCACHE_TYPE', getenv('LDAPAUTH_USERCACHE_TYPE') ?: 1);

and for runtime, the app is running with these env vars:

- name: LDAPAUTH_HOST
  value: ldap://xxx
- name: LDAPAUTH_PORT
  value: '3268'
- name: LDAPAUTH_BASE
  value: DC=xxx,DC=xxx
- name: LDAPAUTH_USERNAME_FIELD
  value: sAMAccountName
- name: LDAPAUTH_SEARCH_USER
  value: CN=yyy,DC=xxx,DC=xxx
- name: LDAPAUTH_SEARCH_PASS
  value: papapassssapapa
- name: LDAPAUTH_SEARCH_FILTER
  value: (&(objectCategory=Person) .....)
- name: LDAPAUTH_USERCACHE_TYPE
  value: '0'

Now what's wrong knowing that i am basing on this image : https://github.com/abdennour/dockerfiles/blob/master/docker-images/yourls/Dockerfile

I think all relevant info has been mentioned.
To not forget, it's MS AD.. but it should be clear also when you check env vars (.i.e sAMAccountName).

Thanks for support