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.34k stars 1.3k forks source link

Alpha Version 11: iNotes Email Issue Resulting in Blank Page on Ticket #18140

Open husisusi opened 1 month ago

husisusi commented 1 month ago

Code of Conduct

Is there an existing issue for this?

Version

GLPI 11-Alpha

Bug description

Hello team,

First, I want to thank you all for the excellent work!

I’m currently testing the Alpha Version 11 and noticed an issue: when sending an email from iNotes (Lotus Notes Web Mailer), a blank page appears in the associated ticket. In debug mode, a Twing Error is displayed.

image

Interestingly, when hovering over the ticket with the mouse, the email content is displayed correctly, so the email text is there but just isn’t shown directly in the ticket.

image

Best regards

Relevant log output

No response

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

Operating system: Linux nagios 5.15.0-121-generic #​131-Ubuntu SMP Fri Aug 9 08:29:53 UTC 2024 x86_64

PHP: 8.3.11 apache2handler

PHP extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, random, Reflection, SPL, session, standard, sodium, apache2handler, intl, mysqlnd, PDO, xml, apcu, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, iconv, imap, ldap, exif, memcache, mysqli, pdo_mysql, pdo_sqlite, Phar, posix, readline, shmop, SimpleXML, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xmlreader, xmlrpc, xmlwriter, xsl, zip, Zend OPcache

Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files" upload_max_filesize="2M" disable_functions=""

Web server: Apache ()

User agent: Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0

Database:

Server Software: Ubuntu 22.04

Server Version: 10.6.18-MariaDB-0ubuntu0.22.04.1

Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Parameters: glpi@localhost/glpi

Host info: Localhost via UNIX socket

Requirements: PHP version (8.3.11) is supported.PHP version (8.3.11) is supported. OS and PHP are relying on 64 bits integers.OS and PHP are relying on 64 bits integers. Sessions configuration is OK.Sessions configuration is OK. Allocated memory is sufficient.Allocated memory is sufficient. Following extensions are installed: dom, fileinfo, filter, libxml, json, simplexml, xmlreader, xmlwriter.Following extensions are installed: dom, fileinfo, filter, libxml, json, simplexml, xmlreader, xmlwriter. mysqli extension is installed.mysqli extension is installed. curl extension is installed.curl extension is installed. gd extension is installed.gd extension is installed. intl extension is installed.intl extension is installed. mbstring extension is installed.mbstring extension is installed. zlib extension is installed.zlib extension is installed. The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present.The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present. openssl extension is installed.openssl extension is installed. Database engine version (10.6.18) is supported.Database engine version (10.6.18) is supported. No files from previous GLPI version detected.No files from previous GLPI version detected. The log file has been created successfully.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.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.

Sessions configuration is secured.Sessions configuration is secured. exif extension is installed.exif extension is installed. ldap extension is installed.ldap extension is installed. openssl extension is installed.openssl extension is installed. Following extensions are installed: bz2, Phar, zip.Following extensions are installed: bz2, Phar, zip. Zend OPcache extension is installed.Zend OPcache extension is installed. Following extensions are installed: ctype, iconv, sodium.Following extensions are installed: ctype, iconv, sodium. Write access to /var/www/html/glpi/marketplace has been validated.Write access to /var/www/html/glpi/marketplace has been validated. Timezones seems loaded in database.Timezones seems loaded in database.

Anything else?

No response

husisusi commented 1 month ago

FYI: When I replace picture.html.twig with the same file from Version 10, the issue is resolved.

husisusi commented 1 month ago

Suggestion:

{% set enable_anonymization = enable_anonymization ?? false %}
{% set avatar_size = avatar_size ?? "avatar-md" %}
{% set anonymized = enable_anonymization and entity_config('anonymize_support_agents', session('glpiactive_entity')) != constant('Entity::ANONYMIZE_DISABLED') %}
{% set user = user_object ?? get_item('User', users_id) %}
{% set with_link = with_link ?? true %}
{% set user_thumbnail = user.getThumbnailPicturePath(enable_anonymization) ?? user.getPicturePath(enable_anonymization) %}
{% set bg_color = user.getUserInitialsBgColor() | default('#cccccc') %}
{% set fg_color = call('Toolbox::getFgColor', [bg_color, 60]) | default('#000000') %}

{% if with_link and not anonymized %}
   <a href="{{ user.getLinkURL() }}" class="d-flex align-items-center">
{% endif %}

<span class="avatar {{ avatar_size }} rounded"
      style="{% if user_thumbnail %}background-image: url({{ user_thumbnail }}); background-color: inherit; {% else %}background-color: {{ bg_color }};{% endif %} color: {{ fg_color }}">
   {% if not user_thumbnail %}
         {{ user.getUserInitials(enable_anonymization) }}
   {% endif %}
</span>

{% if with_link and not anonymized %}
   {% if display_login %}
      <span class="ms-2">{{ user.fields['name'] }}</span>
   {% endif %}
   </a>
{% endif %}
cconard96 commented 1 month ago

I cannot see how this error would be possible. bg_color is only ever set to the result of User::getUserInitialsBgColor() which only ever returns a string (not null) and it has its return type set to string so it would throw a different error if null was ever tried to be returned.

What errors are in your GLPI logs (files/_log folder)?

husisusi commented 1 month ago

I even recorded a video as proof:

https://github.com/user-attachments/assets/6f8ffcc5-dd5d-41a1-a6b9-01990d6ac438

husisusi commented 1 month ago

@cconard96 php-errors.log:

[2024-10-26 07:24:51] glpiphplog.ERROR: Uncaught PHP Exception Glpi\Exception\Http\NotFoundHttpException: "" at debug.php line 67 {"exception":"[object] (Glpi\\Exception\\Http\\NotFoundHttpException(code: 0):  at /var/www/html/glpi/ajax/debug.php:67)"} 
[2024-10-26 07:25:29] glpiphplog.CRITICAL:   *** Twig Error (Twig\Error\RuntimeError): "An exception has been thrown during the rendering of a template ("Toolbox::getFgColor(): Argument #1 ($color) must be of type string, null given")." in template "/var/www/html/glpi/templates/components/user/picture.html.twig" at line 49
  Backtrace :
  vendor/twig/twig/src/Template.php:349              Twig\Template->yield()
  vendor/twig/twig/src/Template.php:364              Twig\Template->display()
  vendor/twig/twig/src/TemplateWrapper.php:35        Twig\Template->render()
  .../twig/twig/src/Extension/CoreExtension.php:1452 Twig\TemplateWrapper->render()
  ...ates/07/0748ed3daeaecbe42c8a4f0afec07b87.php:61 Twig\Extension\CoreExtension::include()
  vendor/twig/twig/src/Template.php:393              __TwigTemplate_3d8ca7b36ff618cf9619027616e96269->doDisplay()
  vendor/twig/twig/src/Template.php:349              Twig\Template->yield()
  vendor/twig/twig/src/Template.php:364              Twig\Template->display()
  vendor/twig/twig/src/TemplateWrapper.php:35        Twig\Template->render()
  .../twig/twig/src/Extension/CoreExtension.php:1452 Twig\TemplateWrapper->render()
  ...ates/09/09ea83015dfe262c04f8be96f0ca7411.php:54 Twig\Extension\CoreExtension::include()
  vendor/twig/twig/src/Template.php:393              __TwigTemplate_f9d8c646b73e73cb119bb45aacc80995->doDisplay()
  vendor/twig/twig/src/Template.php:349              Twig\Template->yield()
  vendor/twig/twig/src/Template.php:364              Twig\Template->display()
  vendor/twig/twig/src/TemplateWrapper.php:35        Twig\Template->render()
  .../twig/twig/src/Extension/CoreExtension.php:1452 Twig\TemplateWrapper->render()
  ...tes/d9/d9b30b0e335d1e3a153bb526a6285aeb.php:136 Twig\Extension\CoreExtension::include()
  vendor/twig/twig/src/Template.php:393              __TwigTemplate_302935b7a41ddd44c45a3db94703fc2b->doDisplay()
  vendor/twig/twig/src/Template.php:349              Twig\Template->yield()
  vendor/twig/twig/src/TemplateWrapper.php:42        Twig\Template->display()
  src/Glpi/Application/View/TemplateRenderer.php:187 Twig\TemplateWrapper->display()
  src/Ticket.php:3992                                Glpi\Application\View\TemplateRenderer->display()
  src/CommonGLPI.php:667                             Ticket->showForm()
  ajax/common.tabs.php:112                           CommonGLPI::displayStandardTab()
  ...Glpi/Controller/LegacyFileLoadController.php:59 require()
  vendor/symfony/http-kernel/HttpKernel.php:101      Glpi\Controller\LegacyFileLoadController->Glpi\Controller\{closure}()
  ...ymfony/http-foundation/StreamedResponse.php:106 Symfony\Component\HttpKernel\HttpKernel::Symfony\Component\HttpKernel\{closure}()
  vendor/symfony/http-foundation/Response.php:423    Symfony\Component\HttpFoundation\StreamedResponse->sendContent()
  src/Glpi/Kernel/Kernel.php:255                     Symfony\Component\HttpFoundation\Response->send()
  public/index.php:58                                Glpi\Kernel\Kernel->sendResponse()
cedric-anne commented 4 weeks ago

@husisusi

Could you remove the directories located inside the files/_cache directory and see if the issue persists.

husisusi commented 3 weeks ago

@cedric-anne

Deleting the folder unfortunately didn’t resolve the issue, it’s still present. If you can provide a temporary email address, I can send a direct email from iNotes to your system for further troubleshooting.

trasher commented 3 weeks ago

Please provide here a .eml file we can use to reproduce and add to our tests cases.

husisusi commented 3 weeks ago

A .eml file won’t help in this case. If I import the .eml file, it works fine. The issue only occurs when sending directly from iNotes.

That was wrong!

husisusi commented 3 weeks ago

Attached is a .eml file. I forgot to mention that my GLPI test system was running on GLPI version 10, and I recently upgraded it to version 11. Test 888.txt