glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.33k stars 1.3k forks source link

LDAP User import - Invalid argument supplied for foreach() #8799

Closed lucafwp closed 3 years ago

lucafwp commented 3 years ago

Describe the bug

When selecting more than 30 users to be imported from LDAP sync and clicking on "Action" button, the following error is showed: Invalid argument supplied for foreach()

Page(s) URL

Starting url: front/ldap.import.php Request goes to: glpi/ajax/massiveaction.php

To reproduce

Steps to reproduce the behavior:

  1. Go to 'Administration >> Users >> LDAP Directory Link >> Import new users'
  2. Show more than 30 results
  3. Select all
  4. Click on "Action"

Expected behavior

The select which let you choose to import users should be shown.

Screenshots

image

Your GLPI setup (you can find it in Setup > General menu, System tab)


Information about system installation and configuration
--
Check if a new version is available
[code]   GLPI 9.5.1 (/glpi => /usr/share/glpi) Installation mode: TARBALL

Operating system: Linux liux.lan 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 

PHP 7.3.11 fpm-fcgi (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apcu, bz2, calendar, cgi-fcgi, ctype, curl,     date, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mysqli,    mysqlnd, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, session, shmop, soap, sockets, sqlite3, standard,   sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib) 
Setup: max_execution_time="300" memory_limit="512M" post_max_size="100M" safe_mode="" session.save_handler="files"  upload_max_filesize="100M"  

Software: Apache ()     Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) 

Chrome/88.0.4324.190 Safari/537.36 
Server Software: MariaDB Server     
Server Version: 10.3.13-MariaDB     
Server SQL Mode:    
Parameters: glpi@mariadb.local/glpi     
Host info: mariadb.local via TCP/IP

Additional context

One of the users listes has a single quote in name. Might be related to this? https://github.com/glpi-project/glpi/issues/6014

cedric-anne commented 3 years ago

Hi,

Please provide the full trace of this error. It can be found in GLPI logs.

Regards

lucafwp commented 3 years ago

Hi @cedric-anne , I can't see any message related to this error in GLPI logs. I think this information extracted from GLPI Dev tools might be helpful. They are related to the request made when clicking Action button.

Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Connection: keep-alive
Content-Length: 1614
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: glpi_dfa5b16f2330075f98b9929df5b4b397=3mhlu1oe6aes0emea2e2g1gcqh
Host: xxxxxxxx
Origin: https://xxxxxxxxxx
Referer: https://xxxxxxxxxx/glpi/front/ldap.import.php?&start=0
sec-ch-ua: "Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36
X-Requested-With: XMLHttpRequest
container: massAuthLDAP477001649
specific_actions[AuthLDAP:import]: Importieren
item[AuthLDAP][usertesting.b]: 1
item[AuthLDAP][usertesting.a]: 1
item[AuthLDAP][testpol]: 1
item[AuthLDAP][svc_gingco]: 1
item[AuthLDAP][scanner_rm]: 1
item[AuthLDAP][root$]: 1
item[AuthLDAP][pruefstaende]: 1
item[AuthLDAP][personal-as4]: 1
item[AuthLDAP][nsu2t]: 1
item[AuthLDAP][leitsta14]: 1
item[AuthLDAP][leitsta13]: 1
item[AuthLDAP][leitsta12]: 1
item[AuthLDAP][externfs]: 1
item[AuthLDAP][buchhaltung.holding]: 1
item[AuthLDAP][buchhaltung-in]: 1
item[AuthLDAP][akyolm]: 1
item[AuthLDAP][adminin21]: 1
item[AuthLDAP][VW381-0-CN-TV]: 1
item[AuthLDAP][VW381-0-CN-MIKO]: 1
item[AuthLDAP][VW381-0-CN-I-Tafel]: 1
item[AuthLDAP][VW336-Miko]: 1
item[AuthLDAP][VW310-PA-TV]: 1
item[AuthLDAP][Testgewerk_IDBuzz]: 1
item[AuthLDAP][SVC_TESTEXPLORER]: 1
item[AuthLDAP][SVC_PAK]: 1
item[AuthLDAP][SVC_MXSREPORT]: 1
item[AuthLDAP][Hyundai_i20_GG-AS_13]: 1
item[AuthLDAP][Flying-Docs]: 1
item[AuthLDAP][Experience]: 1
item[AuthLDAP][EKXP-Gewerk]: 1
item[AuthLDAP][EESB]: 1
item[AuthLDAP][E3MuService]: 1
item[AuthLDAP][E3MUADMIN]: 1
item[AuthLDAP][BueroDigiTeam]: 1
item[AuthLDAP][Booking]: 1
item[AuthLDAP][ASAP_Klimakammer_SS4]: 1
item[AuthLDAP][ASAP$]: 1
item[AuthLDAP][1305_VN7600_FlexRay]: 1
item[AuthLDAP][1305_VN1640A_CANcase]: 1
item[AuthLDAP][: 1
cedric-anne commented 3 years ago

Hi,

Can you check #8809 ? Not sure you problem is related to this, but if you have a user that has a square bracket or a quote in its name, it can explain your bug.

Regards