fixes for PHP 8

This commit is contained in:
Dave Umrysh 2022-12-30 14:17:24 -07:00
parent 0a47a984e0
commit 227b3d503c
2 changed files with 25 additions and 11 deletions

View File

@ -571,7 +571,7 @@ class FPDI extends FPDF_TPL
reset ($value[1]);
while (list($k, $v) = each($value[1])) {
foreach ($value[1] as $k => $v) {
$this->_straightOut($k . ' ');
$this->_writeValue($v);
}

View File

@ -218,16 +218,30 @@ class fpdi_pdf_parser extends pdf_parser
if (!is_null($box) && $box[0] == pdf_parser::TYPE_ARRAY) {
$b = $box[1];
return array(
'x' => $b[0][1] / $k,
'y' => $b[1][1] / $k,
'w' => abs($b[0][1] - $b[2][1]) / $k,
'h' => abs($b[1][1] - $b[3][1]) / $k,
'llx' => min($b[0][1], $b[2][1]) / $k,
'lly' => min($b[1][1], $b[3][1]) / $k,
'urx' => max($b[0][1], $b[2][1]) / $k,
'ury' => max($b[1][1], $b[3][1]) / $k,
);
if($k == NULL){
return array(
'x' => NAN,
'y' => NAN,
'w' => NAN,
'h' => NAN,
'llx' => NAN,
'lly' => NAN,
'urx' => NAN,
'ury' => NAN,
);
}else{
return array(
'x' => $b[0][1] / $k,
'y' => $b[1][1] / $k,
'w' => abs($b[0][1] - $b[2][1]) / $k,
'h' => abs($b[1][1] - $b[3][1]) / $k,
'llx' => min($b[0][1], $b[2][1]) / $k,
'lly' => min($b[1][1], $b[3][1]) / $k,
'urx' => max($b[0][1], $b[2][1]) / $k,
'ury' => max($b[1][1], $b[3][1]) / $k,
);
}
} else if (!isset($page[1][1]['/Parent'])) {
return false;
} else {