kartik-v / yii2-mpdf

A Yii2 wrapper component for the mPDF library which generates PDF files from UTF-8 encoded HTML.
http://demos.krajee.com/mpdf
Other
161 stars 150 forks source link

Illegal string offset 'ID' on PHP 7.1 #37

Closed adrianpaiva1 closed 5 years ago

adrianpaiva1 commented 8 years ago

I'm getting Illegal string offset 'ID' after upgrading to PHP 7.1 is there a workaround for this?

vendor/mpdf/mpdf/classes/cssmgr.php

adrianpaiva1 commented 8 years ago

1293129412951296129712981299130013011302130313041305130613071308130913101311 { $p = array(); $zp = array();

    $classes = array();
    if (isset($attr['CLASS'])) {
        $classes = preg_split('/\s+/', $attr['CLASS']);
    }
    if (!isset($attr['ID'])) {
        $attr['ID'] = '';
    }
    // mPDF 6
    $shortlang = '';
    if (!isset($attr['LANG'])) {
        $attr['LANG'] = '';
    } else {
        $attr['LANG'] = strtolower($attr['LANG']);
        if (strlen($attr['LANG']) == 5) {
            $shortlang = substr($attr['LANG'], 0, 2);
adrianpaiva1 commented 8 years ago

I've managed to resolve this issue on PHP 7.1 by adding "$attr = is_array($attr) ? $attr : [];" to the cssmgr.php on line 1296.

Could you possibly release a new update with this included?

ItsReddi commented 7 years ago

@kartik-v same here

MassimilianoMancini commented 7 years ago

Resolved here https://github.com/mpdf/mpdf/issues/278 just add "mpdf/mpdf": "6.1.3",

in composer.json

StalkAlex commented 7 years ago

There is an issue about adding support for 7th version https://github.com/kartik-v/yii2-mpdf/issues/45. Officially mPdf v6 will not provide support for php 7.0+, so there is one way to use only 7th version. You can have a look at my fork https://github.com/StalkAlex/yii2-mpdf/tree/php71 where I resolved this problem by updating mPdf to 7th version.

jeffersonor900 commented 6 years ago

StalkAlex Erro 404

StalkAlex commented 6 years ago

@jeffersonor900 sorry, I dropped my fork as everything has been working in Kartik's repository. Please use last version, you'll need to change only package version.

"kartik-v/yii2-mpdf": "dev-master"
jeffersonor900 commented 6 years ago

adrianpaiva1 tengo el mismo problema...

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.