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.24k stars 1.29k forks source link

[9.5.7] NotificationEventAjax::send should not be called! #10768

Closed kofe88 closed 2 years ago

kofe88 commented 2 years ago

Code of Conduct

Is there an existing issue for this?

Version

9.5.7

Bug description

/front/queuednotification.php A lot of unsent notifications accumulate. When you try to send (Action - send), a window pops up "Unsuccessful operation (Permission issues:0, failures:1)". image image image

Relevant log output

➜ cat php-errors.log | more
[2022-02-23 23:38:10] glpiphplog.ERROR: NotificationEventAjax::send() in /var/www/html/glpi/inc/notifica
tioneventajax.class.php line 75
NotificationEventAjax::send should not be called!  {"user":"7@support"}

Page URL

/front/queuednotification.php

Steps To reproduce

  1. Go to /front/queuednotification.php
  2. Select unsend notification
  3. Send it

Your GLPI setup information

[code]   GLPI 9.5.7 ( => /var/www/html/glpi) 
Installation mode: TARBALL 
Current language:en_GB
--

Operating system: Linux support 5.4.0-100-generic #113~18.04.1-Ubuntu SMP Mon Feb 7 15:02:59 UTC 2022 x86_64 
PHP 7.4.28 apache2handler (Core, FFI, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apc, apcu, bz2,  
calendar, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imagick, imap, intl, json, ldap,   
libxml, mbstring, memcache, mysqli, mysqlnd, openssl, pcre, pdo_mysql, posix, pspell, readline, session, shmop, snmp, soap,     
sockets, sodium, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib) 
Setup: max_execution_time="30" memory_limit="256M" post_max_size="256M" safe_mode="" session.save_handler="files"   
upload_max_filesize="256M"  
Software: Apache/2.4.29 (Ubuntu) (Apache/2.4.29 (Ubuntu) Server at support.site.ru Port 443)    
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 Server Software: mariadb.org binary distribution    
Server Version: 10.6.7-MariaDB-1:10.6.7+maria~bionic    
Server SQL Mode:    Parameters: admin@localhost/admin
Host info: Localhost via UNIX socket     
PHP version is at least 7.2.0 - Perfect! 
Sessions support is available - Perfect! 
Allocated memory > 64 Mio - Perfect! 
mysqli extension is installed 
ctype extension is installed 
fileinfo extension is installed 
json extension is installed 
mbstring extension is installed 
iconv extension is installed 
zlib extension is installed 
curl extension is installed 
gd extension is installed 
simplexml extension is installed 
intl extension is installed 
ldap extension is installed 
apcu extension is installed 
Zend OPcache extension is installed 
xmlrpc extension is installed 
exif extension is installed 
zip extension is installed 
bz2 extension is installed 
sodium extension is installed 
Database version seems correct (10.6.7) - Perfect! 
Timezones seems loaded in database 
The log file has been created successfully. 
Write access to /var/www/html/glpi/files/_cache has been validated. 
Write access to /var/www/html/glpi/config has been validated. 
Write access to /var/www/html/glpi/files/_cron has been validated. 
Write access to /var/www/html/glpi/files has been validated. 
Write access to /var/www/html/glpi/files/_dumps has been validated. 
Write access to /var/www/html/glpi/files/_graphs has been validated. 
Write access to /var/www/html/glpi/files/_lock has been validated. 
Write access to /var/www/html/glpi/files/_pictures has been validated. 
Write access to /var/www/html/glpi/files/_plugins has been validated. 
Write access to /var/www/html/glpi/files/_rss has been validated. 
Write access to /var/www/html/glpi/files/_sessions has been validated. 
Write access to /var/www/html/glpi/files/_tmp has been validated. 
Write access to /var/www/html/glpi/files/_uploads has been validated.
Write access to /var/www/html/glpi/marketplace has been validated. 
Web access to files directory is protected

GLPI_ROOT: /var/www/html/glpi 
GLPI_CONFIG_DIR: /var/www/html/glpi/config 
GLPI_VAR_DIR: /var/www/html/glpi/files 
GLPI_MARKETPLACE_DIR: /var/www/html/glpi/marketplace 
GLPI_USE_CSRF_CHECK: 1 
GLPI_CSRF_EXPIRES: 7200 
GLPI_CSRF_MAX_TOKENS: 100 
GLPI_USE_IDOR_CHECK: 1 
GLPI_IDOR_EXPIRES: 7200 
GLPI_ALLOW_IFRAME_IN_RICH_TEXT:  
GLPI_TELEMETRY_URI: https://telemetry.glpi-project.org 
GLPI_INSTALL_MODE: TARBALL 
GLPI_NETWORK_MAIL: glpi@teclib.com 
GLPI_NETWORK_SERVICES: https://services.glpi-network.com 
GLPI_MARKETPLACE_PRERELEASES:  
GLPI_MARKETPLACE_ALLOW_OVERRIDE: 1 
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: 1 
GLPI_USER_AGENT_EXTRA_COMMENTS:  
GLPI_AJAX_DASHBOARD: 1 
GLPI_CALDAV_IMPORT_STATE: 0 
GLPI_DEMO_MODE: 0 
GLPI_FORCE_EMPTY_SQL_MODE: 1 
GLPI_DOC_DIR: /var/www/html/glpi/files 
GLPI_CACHE_DIR: /var/www/html/glpi/files/_cache 
GLPI_CRON_DIR: /var/www/html/glpi/files/_cron 
GLPI_DUMP_DIR: /var/www/html/glpi/files/_dumps 
GLPI_GRAPH_DIR: /var/www/html/glpi/files/_graphs 
GLPI_LOCAL_I18N_DIR: /var/www/html/glpi/files/_locales 
GLPI_LOCK_DIR: /var/www/html/glpi/files/_lock 
GLPI_LOG_DIR: /var/www/html/glpi/files/_log 
GLPI_PICTURE_DIR: /var/www/html/glpi/files/_pictures 
GLPI_PLUGIN_DOC_DIR: /var/www/html/glpi/files/_plugins 
GLPI_RSS_DIR: /var/www/html/glpi/files/_rss 
GLPI_SESSION_DIR: /var/www/html/glpi/files/_sessions 
GLPI_TMP_DIR: /var/www/html/glpi/files/_tmp 
GLPI_UPLOAD_DIR: /var/www/html/glpi/files/_uploads 
GLPI_NETWORK_REGISTRATION_API_URL: https://services.glpi-network.com/api/registration/ 
GLPI_MARKETPLACE_PLUGINS_API_URI: https://services.glpi-network.com/api/glpi-plugins/ 
GLPI_I18N_DIR: /var/www/html/glpi/locales 
GLPI_VERSION: 9.5.7 
GLPI_SCHEMA_VERSION: 9.5.7 
GLPI_MIN_PHP: 7.2.0 
GLPI_YEAR: 2022

htmlawed/htmlawed version 1.2.5 in (/var/www/html/glpi/vendor/htmlawed/htmlawed) 
phpmailer/phpmailer version 6.1.6 in (/var/www/html/glpi/vendor/phpmailer/phpmailer/src) 
simplepie/simplepie version 1.5.6 in (/var/www/html/glpi/vendor/simplepie/simplepie/library) 
tecnickcom/tcpdf version 6.3.5 in (/var/www/html/glpi/vendor/tecnickcom/tcpdf) 
michelf/php-markdown in (/var/www/html/glpi/vendor/michelf/php-markdown/Michelf) 
true/punycode in (/var/www/html/glpi/vendor/true/punycode/src) 
iamcal/lib_autolink in (/var/www/html/glpi/vendor/iamcal/lib_autolink) 
sabre/dav in (/var/www/html/glpi/vendor/sabre/dav/lib/DAV) 
sabre/http in (/var/www/html/glpi/vendor/sabre/http/lib) 
sabre/uri in (/var/www/html/glpi/vendor/sabre/uri/lib) 
sabre/vobject in (/var/www/html/glpi/vendor/sabre/vobject/lib) 
laminas/laminas-cache in (/var/www/html/glpi/vendor/laminas/laminas-cache/src) 
laminas/laminas-i18n in (/var/www/html/glpi/vendor/laminas/laminas-i18n/src) 
laminas/laminas-serializer in (/var/www/html/glpi/vendor/laminas/laminas-serializer/src) 
monolog/monolog in (/var/www/html/glpi/vendor/monolog/monolog/src/Monolog) 
sebastian/diff in (/var/www/html/glpi/vendor/sebastian/diff/src) 
elvanto/litemoji in (/var/www/html/glpi/vendor/elvanto/litemoji/src) 
symfony/console in (/var/www/html/glpi/vendor/symfony/console) 
scssphp/scssphp in (/var/www/html/glpi/vendor/scssphp/scssphp/src) 
laminas/laminas-mail in (/var/www/html/glpi/vendor/laminas/laminas-mail/src/Protocol) 
laminas/laminas-mime in (/var/www/html/glpi/vendor/laminas/laminas-mime/src) 
rlanvin/php-rrule in (/var/www/html/glpi/vendor/rlanvin/php-rrule/src) 
blueimp/jquery-file-upload in (/var/www/html/glpi/vendor/blueimp/jquery-file-upload/server/php) 
ramsey/uuid in (/var/www/html/glpi/vendor/ramsey/uuid/src) 
psr/log in (/var/www/html/glpi/vendor/psr/log/Psr/Log) 
psr/simple-cache in (/var/www/html/glpi/vendor/psr/simple-cache/src) 
mexitek/phpcolors in (/var/www/html/glpi/vendor/mexitek/phpcolors/src/Mexitek/PHPColors) 
guzzlehttp/guzzle in (/var/www/html/glpi/vendor/guzzlehttp/guzzle/src) 
guzzlehttp/psr7 in (/var/www/html/glpi/vendor/guzzlehttp/psr7/src) 
wapmorgan/unified-archive in (/var/www/html/glpi/vendor/wapmorgan/unified-archive/src) 
paragonie/sodium_compat in (/var/www/html/glpi/vendor/paragonie/sodium_compat/src) 
phpCas version 1.3.3 in (/usr/share/php)

Server: 'dc.site.ru', Port: '389', BaseDN: 'DC=site,DC=ru', 
Connection filter:      '(&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))', RootDN: 'glpi', Use TLS: none

Not active

Way of sending emails: SMTP (anonymous@mail.site.ru)

Name: 'admin@site.ru' Active: Yes   
Server: '{mail.site.ru/imap/ssl/novalidate-cert/notls}INBOX' Login: 'admin' Password: Yes

activity             Name: Activities                     Version: 3.0.0      State: Not installed  
actualtime           Name: ActualTime                     Version: 1.5.1      State: Installed / not activated  
advancedplanning     Name: advancedplanning               Version: 1.0.0      State: Installed / not activated  
barcode              Name: Barcode                        Version: 2.6.2      State: Enabled    
connections          Name: Connections                    Version: 9.5        State: Not installed  
datainjection        Name: Data injection                 Version: 2.9.0      State: Not installed  
databases            Name: Databases                      Version: 2.3.2      State: Not installed  
formcreator          Name: Form Creator                   Version: 2.12.4     State: Installed / not activated  
fusioninventory      Name: FusionInventory                Version: 9.5+3.0    State: Enabled    
gappessentials       Name: Gapp Essentials                Version: 1.2.0      State: Enabled    
sccm                 Name: Interface - SCCM               Version: 2.3.0      State: Installed / not activated  
geninventorynumber   Name: Inventory number generation    Version: 2.5.1      State: Installed / not activated  
addressing           Name: IP Adressing                   Version: 2.9.0      State: Not installed  
uninstall            Name: Item's Lifecycle (uninstall)   Version: 2.7.2      State: Installed / not activated  
livechat             Name: Livechat                       Version: 1.0.4      State: Installed / not activated  
mailanalyzer         Name: Mail Analyzer                  Version: 2.0.2      State: Not installed  
processmaker         Name: Process Maker                  Version: 4.0.11     State: Enabled    
room                 Name: Rooms                          Version: 3.1.3      State: Not installed  
taskdrop             Name: TaskDrop                       Version: 1.2.0      State: Enabled    
telegrambot          Name: TelegramBot                    Version: 3.0        State: Enabled    
useditemsexport      Name: Used items export              Version: 2.4.0      State: Enabled    
webresources         Name: Web Resources                  Version: 1.3.2      State: Installed / not activated  
yagp                 Name: yagp                           Version: 1.2.0      State: Enabled    
satisfaction         Name: Больше вопросов для оценки удо Version: 1.5.2      State: Installed / not        activated   
itilcategorygroups   Name: Группы ITIL Категории     Version: 2.4.2      State: Enabled     
fields               Name: Дополнительные поля    Version: 1.12.9     State: Installed / not activated  
environment          Name: Окружение                      Version: 2.4.1      State: Not installed  
dashboard            Name: Панель отчетов              Version: 1.0.2      State: Enabled   
escalade             Name: Переназначение             Version: 2.7.2      State: Enabled    
pdf                  Name: Печать в PDF                   Version: 2.0.0      State: Enabled    
behaviors            Name: Поведения                      Version: 2.4.1      State: Not installed  
screenshot           Name: Сделать и приложить снимок экр Version: 1.1.6      State: Enabled    
tasklists            Name: Список задач                  Version: 1.6.0      State: Enabled     
treeview             Name: Список по местонахождению Version: 1.9.1      State: Enabled     
printercounters      Name: Счетчики принтера        Version: 1.7.0      State: Not installed    
news                 Name: Уведомления                   Version: 1.9.1      State: Enabled     
order                Name: Управление заказами    Version: 2.7.6      State: Installed / not activated  
genericobject        Name: Управление объектами  Version: 2.11.0     State: Installed / not activated   
tag                  Name: Управление тэгами        Version: 2.8.2      State: Enabled
[/code]

Anything else?

No response

cconard96 commented 2 years ago

Looks like a duplicate of #10612.

This was fixed for the upcoming GLPI version 10 with #10679. If the issue is the same, it will need backported to 9.5.

cedric-anne commented 2 years ago

Browser notifications cannot be sent by administrator. Indeed, as they are displayed in the target user browser, there is no way to make them reach the user when he is not connected. So it is not possible to send them.

If you want to clean the queue, is to filter on "browser" mode, then put them all in trashbin using massive actions. image

A 9.5 backport of #10679 is, IMHO, not really necessary, as it will just prevent using the "send" action on browser notifications.