mirror of
https://github.com/tecnickcom/TCPDF.git
synced 2025-04-20 22:12:32 +02:00
Fix Infinite Loop in Multicell with Auto Page Breaks Off (#473)
The updated places that used `AcceptPageBreak` assumed that a page break was added and increased X by the margin. However, if the break wasn't added, it would put the text further to the right to the point that the width because so small or negative and no characters fit, causing an infinite loop. Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
This commit is contained in:
parent
56e5dfdf23
commit
5596537f8f
32
tcpdf.php
32
tcpdf.php
@ -6495,14 +6495,16 @@ class TCPDF {
|
||||
$shy = false;
|
||||
// account for margin changes
|
||||
if ((($this->y + $this->lasth) > $this->PageBreakTrigger) AND ($this->inPageBody())) {
|
||||
$this->AcceptPageBreak();
|
||||
if ($this->rtl) {
|
||||
$this->x -= $margin['R'];
|
||||
} else {
|
||||
$this->x += $margin['L'];
|
||||
if ($this->AcceptPageBreak())
|
||||
{
|
||||
if ($this->rtl) {
|
||||
$this->x -= $margin['R'];
|
||||
} else {
|
||||
$this->x += $margin['L'];
|
||||
}
|
||||
$this->lMargin += $margin['L'];
|
||||
$this->rMargin += $margin['R'];
|
||||
}
|
||||
$this->lMargin += $margin['L'];
|
||||
$this->rMargin += $margin['R'];
|
||||
}
|
||||
$w = $this->getRemainingWidth();
|
||||
$wmax = ($w - $this->cell_padding['L'] - $this->cell_padding['R']);
|
||||
@ -6700,14 +6702,16 @@ class TCPDF {
|
||||
}
|
||||
// account for margin changes
|
||||
if ((($this->y + $this->lasth) > $this->PageBreakTrigger) AND ($this->inPageBody())) {
|
||||
$this->AcceptPageBreak();
|
||||
if ($this->rtl) {
|
||||
$this->x -= $margin['R'];
|
||||
} else {
|
||||
$this->x += $margin['L'];
|
||||
if ($this->AcceptPageBreak())
|
||||
{
|
||||
if ($this->rtl) {
|
||||
$this->x -= $margin['R'];
|
||||
} else {
|
||||
$this->x += $margin['L'];
|
||||
}
|
||||
$this->lMargin += $margin['L'];
|
||||
$this->rMargin += $margin['R'];
|
||||
}
|
||||
$this->lMargin += $margin['L'];
|
||||
$this->rMargin += $margin['R'];
|
||||
}
|
||||
$w = $this->getRemainingWidth();
|
||||
$wmax = $w - $this->cell_padding['L'] - $this->cell_padding['R'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user