mpdf / mpdf

PHP library generating PDF files from UTF-8 encoded HTML
https://mpdf.github.io
GNU General Public License v2.0
4.37k stars 1.06k forks source link

Add isset to if #1726

Closed lightingraven closed 1 year ago

lightingraven commented 1 year ago

There is a bad validation on the line 22377 of Mpdf.php

Instead this:

<?php
if ($table['background-image']['gradient'] && preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient/', $table['background-image']['gradient'])) {

Should be:

<?php
if (isset($table['background-image']['gradient']) && preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient/', $table['background-image']['gradient'])) {

Otherwise, you get the error Undefined index: gradient

finwe commented 1 year ago

The issue is missing sample code to reproduce.

finwe commented 1 year ago

Can be reopened once the sample is added.