spipu / html2pdf

OFFICIAL PROJECT | HTML to PDF converter written in PHP
http://html2pdf.fr/en/default
Open Software License 3.0
1.68k stars 748 forks source link

Array and string offset access syntax with curly braces is no longer supported #650

Open jhonnymakis opened 3 years ago

jhonnymakis commented 3 years ago

PHP Fatal error: Array and string offset access syntax with curly braces is no longer supported in /vendor/tecnickcom/tcpdf/tcpdf.php on line 16900

composer require spipu/html2pdf

Using PHP 8.0

W0rma commented 3 years ago

/vendor/tecnickcom/tcpdf/tcpdf.php on line 16900

@jhonnymakis The error is obviously triggered by tecnickcom/tcpdf which is just a dependency of this package.

Which version of tecnickcom/tcpdf are you using? This error should have been fixed in https://github.com/tecnickcom/TCPDF/pull/134 which was part of version 6.3.0.

jAKErCZ commented 3 years ago

Yes some error.

Fatal error: Array and string offset access syntax with curly braces is no longer supported in C:\xampp\htdocs\projects\ratinho\works\sladkova-akademie\vendor\tecnickcom\tcpdf\tcpdf.php on line 16900

Using PHP 8.0


brick/money                            0.5.2     Money and currency library
clue/stream-filter                     v1.5.0    A simple and modern approach to stream filtering in PHP
contributte/application                v0.5.1    Extra contrib to nette/application
contributte/comgate                    v0.2.0    Comgate Payment Gateway for Nette Framework
contributte/console                    v0.9.1    Best Symfony Console for Nette Framework
contributte/di                         v0.5.1    Extra contrib to nette/di
contributte/translation                v0.9.3    Symfony/Translation integration for Nette Framework.
dibi/dibi                              v4.2.3    Dibi is Database Abstraction Library for PHP
dompdf/dompdf                          v1.0.2    DOMPDF is a CSS 2.1 compliant HTML to PDF converter
froala/wysiwyg-editor-php-sdk          4.0.4     PHP SDK for Froala WYSIWYG Editor
geniv/nette-general-form               v1.1.6    Form general class for Nette Framework
guzzlehttp/guzzle                      7.3.0     Guzzle is a PHP HTTP client library
guzzlehttp/promises                    1.4.1     Guzzle promises library
guzzlehttp/psr7                        1.8.2     PSR-7 message implementation that also provides common utility me...
heureka/inflection                     v3.0.3    Czech inflection library
heureka/overeno-zakazniky              3.0.3     Heureka 'Ověřeno zákazníky' (ShopCertification) service API i...
intervention/image                     2.6.1     Image handling and manipulation library with support for Laravel ...
jakercz/datagrid                       v6.9.2    DataGrid for Nette Framework: filtering, sorting, pagination, tre...
jakercz/nette-mailerlite               v2.1.7    MailerLite newsletter component for Nette Framework
knplabs/knp-snappy                     v1.2.1    PHP5 library allowing thumbnail, snapshot or PDF generation from ...
knplabs/knp-snappy-bundle              v1.8.0    Easily create PDF and images in Symfony by converting Twig/HTML t...
lasserafn/php-initial-avatar-generator 4.2.1     A package to generate avatars with initials for PHP
lasserafn/php-initials                 3.1       A package to generate initials in PHP
lasserafn/php-string-script-language   0.3       Detect language/encoding of a string in PHP
latte/latte                            v2.10.3   ☕ Latte: the intuitive and fast template engine for those who w...
mailerlite/mailerlite-api-v2-php-sdk   0.3.2     MailerLite API v2 PHP SDK
meyfa/php-svg                          v0.9.1    Read, edit, write, and render SVG files with PHP
mpdf/mpdf                              v8.0.12   PHP library generating PDF files from UTF-8 encoded HTML
myclabs/deep-copy                      1.10.2    Create deep copies (clones) of your objects
nette/application                      v3.1.3    🏆 Nette Application: a full-stack component-based MVC kernel f...
nette/bootstrap                        v3.1.1    🅱  Nette Bootstrap: the simple way to configure and bootstrap ...
nette/caching                          v3.1.1    ⏱ Nette Caching: library with easy-to-use API and many cache ba...
nette/component-model                  v3.0.1    ⚛ Nette Component Model
nette/database                         v3.1.3    💾 Nette Database: layer with a familiar PDO-like API but much ...
nette/di                               v3.0.9    💎 Nette Dependency Injection Container: Flexible, compiled and...
nette/finder                           v2.5.2    🔍 Nette Finder: find files and directories with an intuitive API.
nette/forms                            v3.1.4    📝 Nette Forms: generating, validating and processing secure fo...
nette/http                             v3.1.2    🌐 Nette Http: abstraction for HTTP request, response and sessi...
nette/mail                             v3.1.7    📧 Nette Mail: handy email creation and transfer library for PH...
nette/neon                             v3.2.2    🍸 Nette NEON: encodes and decodes NEON file format.
nette/php-generator                    v3.6.0    🐘 Nette PHP Generator: generates neat PHP code for you. Suppor...
nette/robot-loader                     v3.4.1    🍀 Nette RobotLoader: high performance and comfortable autoload...
nette/routing                          v3.0.2    Nette Routing: two-ways URL conversion
nette/schema                           v1.2.1    📐 Nette Schema: validating data structures against a given Sch...
nette/security                         v3.1.4    🔑 Nette Security: provides authentication, authorization and a...
nette/tester                           v2.4.1    Nette Tester: enjoyable unit testing in PHP with code coverage re...
nette/utils                            v3.2.3    🛠  Nette Utils: lightweight utilities for string & array manip...
nyholm/psr7                            1.4.1     A fast PHP7 implementation of PSR-7
overtrue/pinyin                        4.0.8     Chinese to pinyin translator.
paragonie/random_compat                v9.99.100 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phenx/php-font-lib                     0.5.2     A library to read, parse, export and make subsets of different ty...
phenx/php-svg-lib                      v0.3.3    A library to read, parse and export to PDF SVG files.
php-http/client-common                 2.4.0     Common HTTP Client implementations and tools for HTTPlug
php-http/discovery                     1.14.0    Finds installed HTTPlug implementations and PSR-7 message factories
php-http/httplug                       2.2.0     HTTPlug, the HTTP client abstraction for PHP
php-http/message                       1.12.0    HTTP Message related tools
php-http/message-factory               v1.0.2    Factory interfaces for PSR-7 HTTP Message
php-http/promise                       1.1.0     Promise used for asynchronous HTTP requests
psr/cache                              2.0.0     Common interface for caching libraries
psr/container                          1.1.1     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                   1.0.0     Standard interfaces for event handling.
psr/http-client                        1.0.1     Common interface for HTTP clients
psr/http-factory                       1.0.1     Common interfaces for PSR-7 HTTP message factories
psr/http-message                       1.0.1     Common interface for HTTP messages
psr/log                                1.1.4     Common interface for logging libraries
ralouphie/getallheaders                3.0.3     A polyfill for getallheaders.
sabberworm/php-css-parser              8.3.1     Parser for CSS Files written in PHP
setasign/fpdi                          v2.3.6    FPDI is a collection of PHP classes facilitating developers to re...
spipu/html2pdf                         v4.6.1    HTML2PDF is a HTML to PDF converter written in PHP5 (it uses TCPD...
symfony/cache                          v5.3.7    Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts                v2.4.0    Generic abstractions related to caching
symfony/config                         v5.3.4    Helps you find, load, combine, autofill and validate configuratio...
symfony/console                        v5.3.7    Eases the creation of beautiful and testable command line interfaces
symfony/dependency-injection           v5.3.7    Allows you to standardize and centralize the way objects are cons...
symfony/deprecation-contracts          v2.4.0    A generic function and convention to trigger deprecation notices
symfony/error-handler                  v5.3.7    Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher               v5.3.7    Provides tools that allow your application components to communic...
symfony/event-dispatcher-contracts     v2.4.0    Generic abstractions related to dispatching event
symfony/filesystem                     v5.3.4    Provides basic utilities for the filesystem
symfony/finder                         v5.3.7    Finds files and directories via an intuitive fluent interface
symfony/framework-bundle               v5.3.7    Provides a tight integration between Symfony components and the S...
symfony/http-client-contracts          v2.4.0    Generic abstractions related to HTTP clients
symfony/http-foundation                v5.3.7    Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                    v5.3.7    Provides a structured process for converting a Request into a Res...
symfony/options-resolver               v5.3.7    Provides an improved replacement for the array_replace PHP function
symfony/polyfill-ctype                 v1.23.0   Symfony polyfill for ctype functions
symfony/polyfill-intl-grapheme         v1.23.1   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer       v1.23.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring              v1.23.1   Symfony polyfill for the Mbstring extension
symfony/polyfill-php73                 v1.23.0   Symfony polyfill backporting some PHP 7.3+ features to lower PHP ...
symfony/polyfill-php80                 v1.23.1   Symfony polyfill backporting some PHP 8.0+ features to lower PHP ...
symfony/polyfill-php81                 v1.23.0   Symfony polyfill backporting some PHP 8.1+ features to lower PHP ...
symfony/process                        v5.3.7    Executes commands in sub-processes
symfony/property-access                v5.3.7    Provides functions to read and write from/to an object or array u...
symfony/property-info                  v5.3.7    Extracts information about PHP class' properties using metadata o...
symfony/routing                        v5.3.7    Maps an HTTP request to a set of configuration variables
symfony/service-contracts              v2.4.0    Generic abstractions related to writing services
symfony/string                         v5.3.7    Provides an object-oriented API to strings and deals with bytes, ...
symfony/translation                    v5.3.7    Provides tools to internationalize your application
symfony/translation-contracts          v2.4.0    Generic abstractions related to translation
symfony/var-dumper                     v5.3.7    Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter                   v5.3.7    Allows exporting any serializable PHP data structure to plain PHP...
tecnickcom/tcpdf                       6.2.26    TCPDF is a PHP class for generating PDF documents and barcodes.
tracy/tracy                            v2.8.7    😎  Tracy: the addictive tool to ease debugging PHP code for co...
uestla/recaptcha-control               8.0.1     reCAPTCHA control for Nette Framework forms```
AMCerasoli commented 3 years ago

I'm having the same problem...

dipu157 commented 3 years ago

i am also facing the same problem and didn't get any solution..

AMCerasoli commented 3 years ago

Use https://github.com/dompdf/dompdf It's much better...

KINNOC commented 2 years ago

I am facing the same problem.

I used dompdf and still got the same error in the same tcpdf file and at the same line

boussou commented 2 years ago

just replace array access via { } by [ ]

KINNOC commented 2 years ago

After performing the replacements, I am told that there is an error on this line self::$_list[trim($line[0])] = trim($line[1]);

The error says Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in C:\xampp\htdocs\cotation_auto\vendor\spipu\html2pdf_class\locale.class .php:69 Stack trace: #0 C:\xampp\htdocs\cotation_auto\vendor\spipu\html2pdf_class\locale.class.php(69): trim(Array) #1 C:\xampp\htdocs\cotation_auto\ vendor\spipu\html2pdf\html2pdf.class.php(133): HTML2PDF_locale::load('fr') #2 C:\xampp\htdocs\cotation_auto\application\controleurs\ImprimeCtrl.php(114): HTML2PDF->__construct ('P', 'A4', 'fr', true, 'UTF-8', 3) #3 C:\xampp\htdocs\cotation_auto\lib\Frontal.php(83): PrintCtrl->contractCotation() # 4

jhologic12 commented 2 years ago

Cordial saludo, Tuve el mismo problema y lo resolví aplicando la sugerencia mencionada por el mister boussou

fomoro commented 2 years ago

todos lo enfrentamos

pbennett87 commented 2 years ago

I have this running perfectly on another domain, using the same setup/versions, the only difference I can see is that I am using a subdomain, anyone else using a subdomain?

arshad853 commented 1 year ago

Same issue for me after upgrading PHP5 to PHP8, Working perfectly on php5. Fatal error: Array and string offset access syntax with curly braces is no longer supported in ..\inc\tcpdf\tcpdf.php on line 16911

spipu commented 1 year ago

which version of html2pdf are you using ? and how did you install it ?

MarceloCacereVi commented 1 year ago

Cuál es el procedimiento para actualizar el? actualmente estoy ytilizando la V. _tcpdf_5.0.002 pero ya no es compatible con las nuevas versiones de PHP.

cjprodas commented 11 months ago

puedes poner el ejemplo donde cambiaste tu codigo porfavor estoy pasando por la misma situacion @jhologic12 te agradeceria que me explicaras un poco mas @boussou

boussou commented 11 months ago

use your editor to perform a global replacement.

To show you I would need to share the full package on Github.

jhologic12 commented 11 months ago

Puede ver mi vídeo donde explico todo en detalle https://youtu.be/63oZJTSwu9s?si=dbj5o8knaMhAAl1K

El mié., 25 de oct. de 2023, 3:47 a. m., Nadir Boussoukaia < @.***> escribió:

use your editor to perform a global replacement.

To show you I would need to share the full package on Github.

— Reply to this email directly, view it on GitHub https://github.com/spipu/html2pdf/issues/650#issuecomment-1778800383, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMRR2ERM3ERIQZD3C5LY273YBDG2ZAVCNFSM4274AIP2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZXHA4DAMBTHAZQ . You are receiving this because you were mentioned.Message ID: @.***>

arruby commented 11 months ago

which version of html2pdf are you using ? and how did you install it ?

im using 5.9.206 version