We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrading from 6.6.5 to 6.7.2 causes an undefined index error in my test scripts.
ErrorException: Undefined array key -1 /Users/gr4376/Projects/webtrees/vendor/tecnickcom/tcpdf/tcpdf.php:18829 /Users/gr4376/Projects/webtrees/vendor/tecnickcom/tcpdf/tcpdf.php:5934
The offending code is $dom[$key-1].
$dom[$key-1]
18829 if ($ln AND (!($cell AND ($dom[$key-1]['value'] == 'table')))) { 18830 $this->Ln($this->lasth); 18831 if (($this->y < $maxbottomliney) AND ($startlinepage == $this->page)) { 18832 $this->y = $maxbottomliney; 18833 } 18834 }
Using git bisect, I have traced the issue to this commit. Removing this change allows the 6.7.2 code to run without error.
git bisect
$ git diff 883cbb44093bf9d2ed47a2ada457ff3368eb0661..1ae5c4721cecb6be1fa1c0bebb506ed454a3e02d diff --git a/tcpdf.php b/tcpdf.php index 51e3c2f..1df2246 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -16389,6 +16389,9 @@ class TCPDF { * @since 3.2.000 (2008-06-20) */ protected function getHtmlDomArray($html) { + if(empty($html)) { + return array(); + } // array of CSS styles ( selector => properties). $css = array(); // get CSS array defined at previous call
Debugging shows that when the $html parameter is an empty string, then the returned array would otherwise be non-empty. For example, this:
$html
array ( 0 => array ( 'tag' => false, 'block' => false, 'value' => '', 'parent' => 0, 'hide' => false, 'fontname' => 'dejavusans', 'fontstyle' => '', 'fontsize' => 8.0, 'font-stretch' => 100, 'letter-spacing' => 0, 'stroke' => 0, 'fill' => true, 'clip' => false, 'line-height' => 1.25, 'bgcolor' => false, 'fgcolor' => array ( 'R' => 0, 'G' => 0, 'B' => 0, ), 'strokecolor' => array ( 'R' => 0, 'G' => 0, 'B' => 0, ), 'align' => '', 'listtype' => '', 'text-indent' => 0, 'text-transform' => '', 'border' => array ( ), 'dir' => 'ltr', ), )
We previously returned an array with a key of 0; we are now returning an empty array. Hence we are getting this error.
0
Elsewhere in the code, I see dependencies on other elements in this array.
I can "fix" the PHP errors by replacing return array() in the change with return array(array('tag'=>false,'value'=>'')).
return array()
return array(array('tag'=>false,'value'=>''))
However, there may be subtle functional changes that I'm missing.
The text was updated successfully, but these errors were encountered:
Fix regression issue #699
8389cec
Please check the version 6.7.3 it should be fixed now.
Sorry, something went wrong.
No branches or pull requests
Upgrading from 6.6.5 to 6.7.2 causes an undefined index error in my test scripts.
The offending code is
$dom[$key-1]
.Using
git bisect
, I have traced the issue to this commit. Removing this change allows the 6.7.2 code to run without error.Debugging shows that when the
$html
parameter is an empty string, then the returned array would otherwise be non-empty. For example, this:We previously returned an array with a key of
0
; we are now returning an empty array. Hence we are getting this error.Elsewhere in the code, I see dependencies on other elements in this array.
I can "fix" the PHP errors by replacing
return array()
in the change withreturn array(array('tag'=>false,'value'=>''))
.However, there may be subtle functional changes that I'm missing.
The text was updated successfully, but these errors were encountered: