php-tcpdf installs outdated code which breaks with " Deprecated: The each() function is deprecated." on PHP version 7.2.7-0ubuntu0.18.04.2
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tcpdf (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I just installed Ubuntu 18.04 LTS Release: 18.04 and the TCPDF packaged with it doesn't work properly with the PHP 7.2.7 which came with the same Ubuntu release:
# apt install php-tcpdf
php-tcpdf is already the newest version (6.2.13+
# php -v
PHP 7.2.7-0ubuntu0.
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.7-
gives me this when I try to download a PDF from a website hosted on Ubuntu 18.04 LTS:
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /usr/share/
TCPDF ERROR: Some data has already been output, can't send PDF file
TCPDF was generating a valid PDF for download before the "upgrade" from Ubuntu 16 to Ubuntu 18 replaced PHP with a newer version that deprecates a function which is needed. A forum post at http://
tags: | added: bionic |
Changed in tcpdf (Ubuntu): | |
status: | New → Fix Committed |
Changed in tcpdf (Ubuntu): | |
status: | Fix Committed → Fix Released |
According to https:/ /github. com/elibyy/ tcpdf-laravel/ issues/ 37 this might be as simple as editing /usr/share/ php/tcpdf/ tcpdf.pdf to replace every instance of:
while (list($id, $name) = each($attr_ array[1] )) {
with:
foreach( $attr_array[ 1] as $id => $name) {
Nonetheless, it would be preferable that the distribution install up-to-date (or at least compatible) versions of all packages so that users don't need to make these sort of patches.