After upgrading a site to VM 3 and Joomla 3.4 I got this error during checkout or when trying to test generating a sample pdf from the store backend.
It appears that libraries/tcpdf/tcpdf.php sets $header_xobjid to -1, rather than false. But in /components/com_virtuemart/helpers/vmpdf.php there is an if statement around the part that builds the Header template that checks for $this->header_xobjid === false. The same Header function in tcpdf.php that is being overridden does this comparison instead:
if ($this->header_xobjid < 0)
I was able to solve the bug with the following which I think is the correct fix:
In: /components/com_virtuemart/helpers/vmpdf.php on line 252:
replace:
if ($this->header_xobjid === false) {
with:
if ($this->header_xobjid < 0)
Which tcpdf version do you have installed?
Because the -1 is NOT just false!
http://en.wikipedia.org/wiki/Three-valued_logic
http://en.wikipedia.org/wiki/Three-state_logic
Btw, SCNR, that is ternary logic.
if ($this->header_xobj_autoreset) {
// reset header xobject template at each page
$this->header_xobjid = -1;
}
The question is now why we have the -1 here,.....
Okey, it looks like that the -1 was used in 5.9, we have now tcpdf 6. I think the correct fix is to set in vmpdf.php line 337
$this->header_xobjid = false;