Skip to content

Array and string offset access syntax with curly braces is deprecated #148

@qjendrzewski

Description

@qjendrzewski

My OS environment is Docker 4.26.1 (131620)

PHP version information:

PHP 7.4.33 (cli) (built: Sep 2 2023 08:03:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
Built on docker from php:7.4-apache

Running Laravel 6.

In config/app.php:

return [
    'providers' => [
        Meneses\LaravelMpdf\LaravelMpdfServiceProvider::class,
    ]
];

I'm using code as follows:

use \Meneses\LaravelMpdf\Facades\LaravelMpdf as ToPDF;
class PDFController extends Controller
{

    public function producePDF()
    {

        $outputFilePath = storage_path('output.pdf');
        $pdf = ToPDF::loadView('path.to.blade.template', [ 'my' => 'abc', 'blade' => 123, 'template' => 'hgf'. variables => 876 ] );
        return $pdf->stream($outputFilePath);

    }

}

The browser response is as follows

ErrorException
Array and string offset access syntax with curly braces is deprecated
File: vendor/mpdf/mpdf/mpdf.php
Line: 2349

This error is clarified by the article at https://php-errors.readthedocs.io/en/latest/messages/array-and-string-offset-access-syntax-with-curly-braces-is-deprecated.html

The offending code is:

$this->mpdf = new mPDF(
	$this->getConfig('mode'),              // mode - default ''
	$this->getConfig('format'),            // format - A4, for example, default ''
	$this->getConfig('default_font_size'), // font size - default 0
	$this->getConfig('default_font'),      // default font family
	$this->getConfig('margin_left'),       // margin_left
	$this->getConfig('margin_right'),      // margin right
	$this->getConfig('margin_top'),        // margin top
	$this->getConfig('margin_bottom'),     // margin bottom
	$this->getConfig('margin_header'),     // margin header
	$this->getConfig('margin_footer'),     // margin footer
	$this->getConfig('orientation')        // L - landscape, P - portrait
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions