pauln / tcpdi_parser

Parser for use with TCPDI, based on TCPDF_PARSER
GNU Lesser General Public License v3.0
27 stars 47 forks source link

PHP v7.4.2 error: Trying to access array offset on value of type bool #27

Open ulises-salinas opened 4 years ago

ulises-salinas commented 4 years ago
File          : tcpdi_parser.php
Version.      : 1.1
Line.         : 1429 
Method.       :  _getPageRotation()
private function _getPageRotation($obj) { // $obj = /Page
        $obj = $this->getObjectVal($obj);
        if (isset ($obj[1][1]['/Rotate'])) {
            $res = $this->getObjectVal($obj[1][1]['/Rotate']);
            if ($res[0] == PDF_TYPE_OBJECT)
                return $res[1];
            return $res;
        } else {
            if (!isset ($obj[1][1]['/Parent'])) {
                return false;
            } else {
                $res = $this->_getPageRotation($obj[1][1]['/Parent']);
               // <<<<< -------   LINE 1429 
                if ($res && $res[0] == PDF_TYPE_OBJECT)
                    return $res[1];
                return $res;
            }
        }
    } 

FIXED With:

 if ($res && $res[0] == PDF_TYPE_OBJECT)
airstarh commented 3 years ago

Hello, I am experiencing the same! However my code is from composer. What could you advice when vendor folder is not in project git? Thank you very much