ticgal / yagp

Yet Another GLPI Plugin
https://tic.gal/en/project/yagp-yet-another-glpi-plugin/
GNU Affero General Public License v3.0
2 stars 1 forks source link

Plugin disabling automatically #42

Open Gibraltar75 opened 4 months ago

Gibraltar75 commented 4 months ago

Hi,

Installed v2.3.1 on 2 different GLPI instalations (10.0.9 and 10.0.15) and get the same behaviour. The plugin automatically disables itself after some seconds of being enabled.

Any suggestions on what it could be?

Thank you.

Gibraltar75 commented 4 months ago

Hi,

No one else having this problem? Any sugestions on what to do or where to check?

OscarBeiro commented 4 months ago

Hi, I can't think of an auto-disabling plugin. Do you have any automation using bin console? Also, the logs could show some hints.

Gibraltar75 commented 4 months ago

Hi, Just tested reenabling the plug in again and checked the logs, this is what I found (GLPI v10.0.15, YAGP v2.3.1):

in Event.log: 2024-06-03 17:36:18 [84@95c40d017651] [setup] [Plugin 35946] 3: Plugin YAGP has been activated by Gibraltar75 (84). 2024-06-03 18:37:02 [@95c40d017651] [setup] [Plugin 35947] 3: Plugin YAGP has been deactivated by Unknown user.

in Php-errors.log [2024-06-03 18:37:01] glpiphplog.WARNING: *** PHP User Warning (512): Error while loading plugin yagp: Return value of PluginYagpConfig::getInstance() must be an instance of mixed, instance of PluginYagpConfig returned in /var/www/html/glpi/src/Plugin.php at line 328 Backtrace : src/Plugin.php:328 trigger_error() src/Plugin.php:272 Plugin::load() inc/includes.php:98 Plugin->init() front/cron.php:44 include()

User side what I see is the plugin getting disabled with no user action. We are only using the plug in to enable the search box on top of the screen to enter a ticket number and get direct access to the ticket.

Any ideias/help?

Thanks.

FrancisTicgal commented 4 months ago

Hello,

Can you show us the php version you are using? I just installed it on a clean glpi with no problem with php 8.1

Regards.

Gibraltar75 commented 4 months ago

Using PHP v8.2.7.

OscarBeiro commented 4 months ago

Please provide your System information. Setup > General > System > Copy System Information. You can obfuscate any sensitive info, like email accounts or emails. Thanks

Gibraltar75 commented 4 months ago

Is this what you're asking?

Information about system installation and configuration
GLPI 10.0.15 ( => /var/www/html/glpi)
Installation mode: TARBALL
Current language:en_GB

Server
 
Operating system: Linux 95c40d017651 4.18.0-305.10.2.el8_4.x86_64 #​1 SMP Mon Jul 12 04:43:18 EDT 2021 x86_64
PHP 8.2.7 apache2handler (Core, FFI, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, bz2, calendar, ctype,
    curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, imagick, imap, intl, json, ldap, libxml,
    mbstring, mysqli, mysqlnd, openssl, pcre, pdo_mysql, posix, random, readline, redis, session, shmop, soap, sockets, sodium,
    standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib)
Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files"
    upload_max_filesize="2M" disable_functions="" 
Software: Apache/2.4.59 (Debian) (Apache/2.4.59 (Debian) Server at ****** Port 80
)
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0
Server Software: Debian 11
    Server Version: 10.5.23-MariaDB-0+deb11u1
    Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
    Parameters: glpiconnect@localhost/******
    Host info: Localhost via UNIX socket

PHP version (8.2.7) is supported.
Sessions configuration is OK.
Allocated memory is sufficient.
mysqli extension is installed.
Following extensions are installed: dom, fileinfo, filter, libxml, json, simplexml, xmlreader, xmlwriter.
curl extension is installed.
gd extension is installed.
intl extension is installed.
zlib extension is installed.
The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present.
Database engine version (10.5.23) is supported.
No files from previous GLPI version detected.
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/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.

Web server root directory configuration seems safe.
Sessions configuration is secured.
OS and PHP are relying on 64 bits integers.
exif extension is installed.
ldap extension is installed.
openssl extension is installed.
Following extensions are installed: bz2, Phar, zip.
Zend OPcache extension is installed.
Following extensions are installed: ctype, iconv, mbstring, sodium.
Write access to /var/www/html/glpi/marketplace has been validated.
Timezones seems loaded in database.

GLPI constants
 
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: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["/^(https?|feed):\\/\\/[^@:]+(\\/.*)?$/"]
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_ALLOW_OVERRIDE: true
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true
GLPI_USER_AGENT_EXTRA_COMMENTS: ""
GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1"
GLPI_AJAX_DASHBOARD: "1"
GLPI_CALDAV_IMPORT_STATE: 0
GLPI_DEMO_MODE: "0"
GLPI_CENTRAL_WARNINGS: "1"
GLPI_TEXT_MAXSIZE: "4000"
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_INVENTORY_DIR: "/var/www/html/glpi/files/_inventories"
GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/"
GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/marketplace/"
GLPI_I18N_DIR: "/var/www/html/glpi/locales"
GLPI_VERSION: "10.0.15"
GLPI_SCHEMA_VERSION: "10.0.15@2eed74704cb07e0bac48b933cbd5c1c356f09629"
GLPI_MARKETPLACE_PRERELEASES: false
GLPI_MIN_PHP: "7.4.0"
GLPI_MAX_PHP: "8.4.0"
GLPI_YEAR: "2024"

Libraries
 
htmlawed/htmlawed version 1.2.14 in (/var/www/html/glpi/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.8.0 in (/var/www/html/glpi/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.8 in (/var/www/html/glpi/vendor/simplepie/simplepie/library)
tecnickcom/tcpdf version 6.4.4 in (/var/www/html/glpi/marketplace/financialreports/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-i18n in (/var/www/html/glpi/vendor/laminas/laminas-i18n/src)
laminas/laminas-servicemanager in (/var/www/html/glpi/vendor/laminas/laminas-servicemanager/src)
monolog/monolog in (/var/www/html/glpi/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/var/www/html/glpi/vendor/sebastian/diff/src)
donatj/phpuseragentparser in (/var/www/html/glpi/vendor/donatj/phpuseragentparser/src/UserAgent)
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)
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)
psr/cache in (/var/www/html/glpi/vendor/psr/cache/src)
league/csv in (/var/www/html/glpi/vendor/league/csv/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)
glpi-project/inventory_format in (/var/www/html/glpi/vendor/glpi-project/inventory_format/lib/php)
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)
symfony/cache in (/var/www/html/glpi/vendor/symfony/cache)
html2text/html2text in (/var/www/html/glpi/vendor/html2text/html2text/src)
symfony/css-selector in (/var/www/html/glpi/vendor/symfony/css-selector)
symfony/dom-crawler in (/var/www/html/glpi/vendor/symfony/dom-crawler)
twig/twig in (/var/www/html/glpi/vendor/twig/twig/src)
twig/string-extra in (/var/www/html/glpi/vendor/twig/string-extra)
symfony/polyfill-ctype not found
symfony/polyfill-iconv not found
symfony/polyfill-mbstring not found
symfony/polyfill-php80 not found
symfony/polyfill-php81 not found
symfony/polyfill-php82 in (/var/www/html/glpi/vendor/symfony/polyfill-php82)
league/oauth2-client in (/var/www/html/glpi/vendor/league/oauth2-client/src/Provider)
league/oauth2-google in (/var/www/html/glpi/vendor/league/oauth2-google/src/Provider)
thenetworg/oauth2-azure in (/var/www/html/glpi/vendor/thenetworg/oauth2-azure/src/Provider)
phpCas version 1.3.8 in (/usr/share/php/CAS/source)

SQL replicas
 
Not active

Notifications
 
Way of sending emails: SMTP+TLS (******@******)

Plugins list
 
    fields               Name: Additional fields              Version: 1.21.8     State: Enabled                                 
        Install Method: Marketplace
    news                 Name: Alerts                         Version: 1.12.2     State: Enabled                                 
        Install Method: Marketplace
    behaviors            Name: Behaviours                     Version: 2.7.3      State: Enabled                                 
        Install Method: Marketplace
    datainjection        Name: Data injection                 Version: 2.13.5     State: Enabled                                 
        Install Method: Marketplace
    escalade             Name: Escalation                     Version: 2.9.6      State: Enabled                                 
        Install Method: Marketplace
    financialreports     Name: Financial reports              Version: 3.0.0      State: Enabled                                 
        Install Method: Marketplace
    formcreator          Name: Form Creator                   Version: 2.13.9     State: Enabled                                 
        Install Method: Marketplace
    glpiinventory        Name: GLPI Inventory                 Version: 1.3.5      State: Enabled                                 
        Install Method: Marketplace
    geninventorynumber   Name: Inventory number generation    Version: 2.8.3      State: Enabled                                 
        Install Method: Marketplace
    oauthimap            Name: Oauth IMAP                     Version: 1.4.3      State: Enabled                                 
        Install Method: Marketplace
    genericobject        Name: Objects management             Version: 2.14.9     State: Enabled                                 
        Install Method: Marketplace
    timelineticket       Name: Timeline of tickets            Version: 10.0+1.2   State: Enabled                                 
        Install Method: Marketplace
    treeview             Name: Tree view                      Version: 1.10.2     State: Enabled                                 
        Install Method: Marketplace
    webresources         Name: Web Resources                  Version: 2.0.4      State: Enabled                                 
        Install Method: Marketplace
    yagp                 Name: YAGP                           Version: 2.3.1      State: Installed / not activated               
        Install Method: Marketplace

OscarBeiro commented 4 months ago

Yes, thank you. I cannot see anything impacting your funny behaviour. I suggest disabling every plugin except YAGP and enabling one by one. We use this plugin daily, and we cannot reproduce your behaviour. It looks like something specific of your setup. Regards,

Gibraltar75 commented 4 months ago

Hi, I've just tested uninstalling the plugin and deleting the directory. Afterwards I've installled plugin from Market place and enabled it. Still the same behaviour - after some seconds (around 10s) the plug in is disabled. I'm not a developer, but checking the GLPI file Plugin.php referenced in the error log it would seem that GLPI is disabling the plugin following an exception:

image

I also see this error:

[Tue Jun 04 15:30:35.697945 2024] [php:warn] [pid 734011] [client 10.129.30.3:42884] PHP Warning: Unable to load plugin "yagp" information. in /var/www/html/glpi/src/Plugin.php on line 621, referer: https://******/front/marketplace.php

Any place else (logs or otherwise) where we could search for more info? I understand that you are not able to reproduce the error. But afaik we are using a default instalation of GLPI, so can't quite understand what could be causing the issue, even if it is on our side.

Thanks.

OscarBeiro commented 4 months ago

This error should be on the PHP errors or the SQL errors file. Also the cron log may help identify which action is disabling it. Add a tail to each of them and check what happens after you enable it.

The thing is if you test it on a clean GLPI, and you will be able to see it's working fine. This is what we have done, and since it works for us, there's nothing more we can do.

Regards,

OscarBeiro commented 4 months ago

Hi, @FrancisTicgal has pointed to the strict_types php policy as the possible problem. Could you please disable it as a workaround? If so, we can provide a patch soon, but you can use it in the meantime.

Obrigado ;)

Gibraltar75 commented 4 months ago

Hi @OscarBeiro

Thanks for the input. I understand you're suggesting to disable strict_type in PHP, but I'm not shure exactly how.

Should I disable it system wide? Is that even possible? (won't it impact other apps running on the same server)? Or should I disable it on a specific file using " declare(strict_types=0)"? And if so in which files should I add this?

Thanks.

FrancisTicgal commented 4 months ago

Hello, I'm going through this whole issue and it looks like this restriction it's not a general setting.

Which leaves me with more questions as to why it fails on your system and how I can recreate the situation and resolve all the bugs I find.

I was able to create a docker with php 8.2.19 and GLPI, install the plugin and configure it without any error. I understand what the error is but not exactly why it occurs, so I will prepare a version trying to solve this typing problem and hopefully you can tell us if it is solved in your system.

Regards.

FrancisTicgal commented 4 months ago

Here is a zip file with the patch. yagp_strongtyping.zip

To apply the changes you have to unzip it to the YAGP plugin folder, and through terminal use the following command: patch -p1 < yagp_strongtyping.patch or git apply yagp_strongtyping.patch

Gibraltar75 commented 4 months ago

Hi,

Thanks for the patch. I've installed it about 10 minutes ago and so far the plug in is still enabled, so looking good. Limited testing (only using the ticket search function) is working as expected.

FrancisTicgal commented 4 months ago

Perfect, thanks for your help. We will review this issue some more and post the new version.

Best regards.

Gibraltar75 commented 4 months ago

Hi,

Just to confirm that after 7 hours the plugin is still enabled and didn't disable itself. Once again thank you.

Will be waiting for the final fix to be made available on the Marketplace.

Gibraltar75 commented 1 week ago

Hi,

Any news on publishing the new version that corrects this issue?

Thanks.