Glpi: Export PDF from ticket list page

Created on 27 Dec 2017  路  5Comments  路  Source: glpi-project/glpi

GLPI 9.2.1 bugfixes

1 - Install fresh glpi without any configuration
2 - Open http://localhost/glpi-master/front/ticket.php
2 - Click export PDF (any option)

Page error: "TCPDF ERROR: Some data has already been output to browser, can't send PDF file"

php error: * PHP Warning(2): Cannot modify header information - headers already sent
Backtrace :
:
vendor/tecnickcom/tcpdf/tcpdf.php:7630 header()
inc/search.class.php:5949 TCPDF->Output()
inc/search.class.php:1529 Search::showFooter()
inc/search.class.php:100 Search::displayDatas()
front/report.dynamic.php:90 Search::showList()

Information about system installation & configuration

[code] 聽 GLPI 9.2.1 (/glpi-master => /var/www/html/glpi-master) Installation mode: TARBALL

Operating system: Linux localhost 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 PHP 7.2.0 apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apc, apcu, bcmath, bz2,     calendar, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, igbinary, imap, json, ldap, libxml,    mbstring, mcrypt, mysqli, mysqlnd, oci8, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, redis, session, shmop,  sockets, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xdebug, xml, xmlreader, xmlrpc, xmlwriter, xsl,   zip, zlib) Setup: max_execution_time="30" memory_limit="2024M" post_max_size="8M" safe_mode="" session.save_handler="files"     upload_max_filesize="2M"  Software: Apache/2.4.6 (CentOS) PHP/7.2.0 ()  Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36 Server Software: MySQL Community Server (GPL)    Server Version: 5.7.20  Server SQL Mode:    Parameters: root@fera/glpi_master   Host info: fera via TCP/IP   mysqli extension is installed ctype extension is installed fileinfo extension is installed json extension is installed mbstring extension is installed zlib extension is installed curl extension is installed gd extension is installed simplexml extension is installed xml extension is installed ldap extension is installed imap extension is installed Zend OPcache extension is installed APCu extension is installed xmlrpc extension is installed /var/www/html/glpi-master/config : OK /var/www/html/glpi-master/files : OK /var/www/html/glpi-master/files/_dumps : OK /var/www/html/glpi-master/files/_sessions : OK /var/www/html/glpi-master/files/_cron : OK /var/www/html/glpi-master/files/_graphs : OK /var/www/html/glpi-master/files/_lock : OK /var/www/html/glpi-master/files/_plugins : OK /var/www/html/glpi-master/files/_tmp : OK /var/www/html/glpi-master/files/_cache : OK /var/www/html/glpi-master/files/_rss : OK /var/www/html/glpi-master/files/_uploads : OK /var/www/html/glpi-master/files/_pictures : OK /var/www/html/glpi-master/files/_log : OK Web access to files directory is protected : OK SELinux mode is Disabled

htmLawed version 1.2.4 in (/var/www/html/glpi-master/lib/htmlawed) phpCas version 1.3.5 in (/var/www/html/glpi-master/vendor/jasig/phpcas/source) PHPMailer version 5.2.26 in (/var/www/html/glpi-master/vendor/phpmailer/phpmailer) SimplePie version 1.5.1 in (/var/www/html/glpi-master/vendor/simplepie/simplepie/library) TCPDF version 6.2.13 in (/var/www/html/glpi-master/vendor/tecnickcom/tcpdf) michelf/php-markdown in (/var/www/html/glpi-master/vendor/michelf/php-markdown/Michelf) true/punycode in (/var/www/html/glpi-master/vendor/true/punycode/src) iacaml/autolink in (/var/www/html/glpi-master/vendor/iamcal/lib_autolink) sabre/vobject in (/var/www/html/glpi-master/vendor/sabre/vobject/lib)

Not active

Way of sending emails: PHP

聽

聽
[/code]


headers before call pdf: print_r(headers_list())

(
    [0] => X-Powered-By: PHP/7.2.0
    [1] => Expires: Thu, 19 Nov 1981 08:52:00 GMT
    [2] => Cache-Control: no-store, no-cache, must-revalidate
    [3] => Pragma: no-cache
    [4] => Content-type: text/html; charset=UTF-8
)

All 5 comments

GLPI is compatible with PHP 7.2 but not the bundled libraries (tcpdf and ZF) thus requires some patch.

Operating system: Linux localhost 3.10.0-693.5.2.el7.x86_64

On RHEL / CentOS, I recommend you use the RPM available in my repository, which use system libraries, which include needed patches for PHP 7.2

See https://blog.remirepo.net/post/2017/09/26/GLPI-version-9.2-en

But indeed, we need to patch these libraries, as part of the GLPI release process.

You need to pull GLPI from remi-test and dependencies from remi (and PHP from remi-php72)

Check php-tcpdf version (6.2.13-4 is the needed version for PHP 7.2) and php-zendframework-*

P.S. but out-of-topic here.

This bug is reproductible in :

  • master
  • 9.2/bugfixes

Not present on 9.1/bugfixes

On 9.3 problem is in :

  • Computers export
  • Tickets export
  • Users export

My running configuration :
Operating system: Windows NT TOUR-ANAEL 6.2 build 9200 (Windows 8 Professional Edition) i586 PHP 5.6.30 apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, apache2handler, bcmath, bz2, calendar, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, json, libxml, mbstring, mcrypt, mhash, mysql, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, pdo_sqlite, session, standard, tokenizer, wddx, xml, xmlreader, xmlwriter, zip, zlib) Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files" upload_max_filesize="2M" Software: Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 (Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 Server at 127.0.0.1 Port 80) Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0 Server Software: mariadb.org binary distribution Server Version: 10.1.21-MariaDB Server SQL Mode: Parameters: [email protected]/glpi3 Host info: 127.0.0.1 via TCP/IP

Fixed on #3356 .
Pull request sent.

@hotdesc thanks for the report !

Regards,
Anael

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trasher picture trasher  路  6Comments

iaanpermana picture iaanpermana  路  4Comments

dlepenven picture dlepenven  路  8Comments

augustoferronato picture augustoferronato  路  8Comments

dvinkic picture dvinkic  路  6Comments