2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Fix for warnings/notices/deprecated messages on PHP 7.4

This commit is contained in:
Adam Zammit
2021-01-28 14:07:17 +11:00
parent e7093af41e
commit ead8e5f0ea
53 changed files with 152 additions and 248 deletions

View File

@@ -2872,7 +2872,7 @@ class TCPDF {
if (empty($orientation)) {
$orientation = $default_orientation;
} else {
$orientation = strtoupper($orientation{0});
$orientation = strtoupper($orientation[0]);
}
if (in_array($orientation, $valid_orientations) AND ($orientation != $default_orientation)) {
$this->CurOrientation = $orientation;
@@ -3324,7 +3324,7 @@ class TCPDF {
$slen = strlen($brd);
$newbrd = array();
for ($i = 0; $i < $slen; ++$i) {
$newbrd[$brd{$i}] = true;
$newbrd[$brd[$i]] = true;
}
$brd = $newbrd;
} elseif (($brd === 1) OR ($brd === true) OR (is_numeric($brd) AND (intval($brd) > 0))) {
@@ -5757,7 +5757,7 @@ class TCPDF {
$slen = strlen($brd);
$newbrd = array();
for ($i = 0; $i < $slen; ++$i) {
$newbrd[$brd{$i}] = array('cap' => 'square', 'join' => 'miter');
$newbrd[$brd[$i]] = array('cap' => 'square', 'join' => 'miter');
}
$brd = $newbrd;
}
@@ -6260,7 +6260,7 @@ class TCPDF {
$slen = strlen($brd);
$newbrd = array();
for ($i = 0; $i < $slen; ++$i) {
$newbrd[$brd{$i}] = array('cap' => 'square', 'join' => 'miter');
$newbrd[$brd[$i]] = array('cap' => 'square', 'join' => 'miter');
}
$brd = $newbrd;
}
@@ -7343,7 +7343,7 @@ class TCPDF {
public function set_mqr($mqr) {
if(!defined('PHP_VERSION_ID')) {
$version = PHP_VERSION;
define('PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4}));
define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4]));
}
if (PHP_VERSION_ID < 50300) {
@set_magic_quotes_runtime($mqr);
@@ -7358,10 +7358,10 @@ class TCPDF {
public function get_mqr() {
if(!defined('PHP_VERSION_ID')) {
$version = PHP_VERSION;
define('PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4}));
define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4]));
}
if (PHP_VERSION_ID < 50300) {
return @get_magic_quotes_runtime();
return @0;
}
return 0;
}
@@ -7834,7 +7834,7 @@ class TCPDF {
$dest = $dest ? 'D' : 'F';
}
$dest = strtoupper($dest);
if ($dest{0} != 'F') {
if ($dest[0] != 'F') {
$name = preg_replace('/[\s]+/', '_', $name);
$name = preg_replace('/[^a-zA-Z0-9_\.-]/', '', $name);
}
@@ -9520,12 +9520,12 @@ class TCPDF {
$font = file_get_contents($fontfile);
$compressed = (substr($file, -2) == '.z');
if ((!$compressed) AND (isset($info['length2']))) {
$header = (ord($font{0}) == 128);
$header = (ord($font[0]) == 128);
if ($header) {
//Strip first binary header
$font = substr($font, 6);
}
if ($header AND (ord($font{$info['length1']}) == 128)) {
if ($header AND (ord($font[$info['length1']]) == 128)) {
//Strip second binary header
$font = substr($font, 0, $info['length1']).substr($font, ($info['length1'] + 6));
}
@@ -10990,7 +10990,7 @@ class TCPDF {
$strarr = array();
$strlen = strlen($str);
for ($i=0; $i < $strlen; ++$i) {
$strarr[] = ord($str{$i});
$strarr[] = ord($str[$i]);
}
// insert new value on cache
$this->cache_UTF8StringToArray[$strkey]['s'] = $strarr;
@@ -11004,7 +11004,7 @@ class TCPDF {
$str .= ''; // force $str to be a string
$length = strlen($str);
for ($i = 0; $i < $length; ++$i) {
$char = ord($str{$i}); // get one string character at time
$char = ord($str[$i]); // get one string character at time
if (count($bytes) == 0) { // get starting octect
if ($char <= 0x7F) {
$unichar = $char; // use the character "as is" because is ASCII
@@ -11286,7 +11286,7 @@ class TCPDF {
* @access public
*/
public function addHtmlLink($url, $name, $fill=false, $firstline=false, $color='', $style=-1, $firstblock=false) {
if (!$this->empty_string($url) AND ($url{0} == '#')) {
if (!$this->empty_string($url) AND ($url[0] == '#')) {
// convert url to internal link
$lnkdata = explode(',', $url);
if (isset($lnkdata[0])) {
@@ -11645,7 +11645,7 @@ class TCPDF {
$j = 0;
for ($i = 0; $i < 256; ++$i) {
$t = $rc4[$i];
$j = ($j + $t + ord($k{$i})) % 256;
$j = ($j + $t + ord($k[$i])) % 256;
$rc4[$i] = $rc4[$j];
$rc4[$j] = $t;
}
@@ -11665,7 +11665,7 @@ class TCPDF {
$rc4[$a] = $rc4[$b];
$rc4[$b] = $t;
$k = $rc4[($rc4[$a] + $rc4[$b]) % 256];
$out .= chr(ord($text{$i}) ^ $k);
$out .= chr(ord($text[$i]) ^ $k);
}
return $out;
}
@@ -11719,7 +11719,7 @@ class TCPDF {
for ($i = 1; $i <= 19; ++$i) {
$ek = '';
for ($j = 0; $j < $len; ++$j) {
$ek .= chr(ord($this->encryptdata['key']{$j}) ^ $i);
$ek .= chr(ord($this->encryptdata['key'][$j]) ^ $i);
}
$enc = $this->_RC4($ek, $enc);
}
@@ -11770,7 +11770,7 @@ class TCPDF {
for ($i = 1; $i <= 19; ++$i) {
$ek = '';
for ($j = 0; $j < $len; ++$j) {
$ek .= chr(ord($owner_key{$j}) ^ $i);
$ek .= chr(ord($owner_key[$j]) ^ $i);
}
$enc = $this->_RC4($ek, $enc);
}
@@ -12084,7 +12084,7 @@ class TCPDF {
++$bslenght;
}
for ($i = 0; $i < $bslenght; $i += 2) {
$string .= chr(hexdec($bs{$i}.$bs{($i + 1)}));
$string .= chr(hexdec($bs[$i].$bs[($i + 1)]));
}
return $string;
}
@@ -16410,7 +16410,7 @@ class TCPDF {
$cnt = count($lines);
for ($i=0; $i < $cnt; ++$i) {
$line = $lines[$i];
if (($line == '') OR ($line{0} == '%')) {
if (($line == '') OR ($line[0] == '%')) {
continue;
}
$len = strlen($line);
@@ -16460,7 +16460,7 @@ class TCPDF {
case 'V':
case 'L':
case 'C': {
$line{$len-1} = strtolower($cmd);
$line[$len-1] = strtolower($cmd);
$this->_out($line);
break;
}
@@ -17383,7 +17383,7 @@ class TCPDF {
$attrib = strtolower(trim($attrib[0]));
if (!empty($attrib)) {
// check if matches class, id, attribute, pseudo-class or pseudo-element
switch ($attrib{0}) {
switch ($attrib[0]) {
case '.': { // class
if (in_array(substr($attrib, 1), $class)) {
$valid = true;
@@ -17450,7 +17450,7 @@ class TCPDF {
break;
}
case ':': { // pseudo-class or pseudo-element
if ($attrib{1} == ':') { // pseudo-element
if ($attrib[1] == ':') { // pseudo-element
// pseudo-elements are not supported!
// (::first-line, ::first-letter, ::before, ::after)
} else { // pseudo-class
@@ -18075,7 +18075,7 @@ class TCPDF {
$tagname = strtolower($tag[1]);
// check if we are inside a table header
if ($tagname == 'thead') {
if ($element{0} == '/') {
if ($element[0] == '/') {
$thead = false;
} else {
$thead = true;
@@ -18090,7 +18090,7 @@ class TCPDF {
} else {
$dom[$key]['block'] = false;
}
if ($element{0} == '/') {
if ($element[0] == '/') {
// *** closing html tag
$dom[$key]['opening'] = false;
$dom[$key]['parent'] = end($level);
@@ -18296,10 +18296,10 @@ class TCPDF {
}
}
// font style
if (isset($dom[$key]['style']['font-weight']) AND (strtolower($dom[$key]['style']['font-weight']{0}) == 'b')) {
if (isset($dom[$key]['style']['font-weight']) AND (strtolower($dom[$key]['style']['font-weight'][0]) == 'b')) {
$dom[$key]['fontstyle'] .= 'B';
}
if (isset($dom[$key]['style']['font-style']) AND (strtolower($dom[$key]['style']['font-style']{0}) == 'i')) {
if (isset($dom[$key]['style']['font-style']) AND (strtolower($dom[$key]['style']['font-style'][0]) == 'i')) {
$dom[$key]['fontstyle'] .= 'I';
}
// font color
@@ -18318,13 +18318,13 @@ class TCPDF {
foreach ($decors as $dec) {
$dec = trim($dec);
if (!$this->empty_string($dec)) {
if ($dec{0} == 'u') {
if ($dec[0] == 'u') {
// underline
$dom[$key]['fontstyle'] .= 'U';
} elseif ($dec{0} == 'l') {
} elseif ($dec[0] == 'l') {
// line-trough
$dom[$key]['fontstyle'] .= 'D';
} elseif ($dec{0} == 'o') {
} elseif ($dec[0] == 'o') {
// overline
$dom[$key]['fontstyle'] .= 'O';
}
@@ -18343,7 +18343,7 @@ class TCPDF {
}
// check for text alignment
if (isset($dom[$key]['style']['text-align'])) {
$dom[$key]['align'] = strtoupper($dom[$key]['style']['text-align']{0});
$dom[$key]['align'] = strtoupper($dom[$key]['style']['text-align'][0]);
}
// check for CSS border properties
if (isset($dom[$key]['style']['border'])) {
@@ -18504,9 +18504,9 @@ class TCPDF {
// font size
if (isset($dom[$key]['attribute']['size'])) {
if ($key > 0) {
if ($dom[$key]['attribute']['size']{0} == '+') {
if ($dom[$key]['attribute']['size'][0] == '+') {
$dom[$key]['fontsize'] = $dom[($dom[$key]['parent'])]['fontsize'] + intval(substr($dom[$key]['attribute']['size'], 1));
} elseif ($dom[$key]['attribute']['size']{0} == '-') {
} elseif ($dom[$key]['attribute']['size'][0] == '-') {
$dom[$key]['fontsize'] = $dom[($dom[$key]['parent'])]['fontsize'] - intval(substr($dom[$key]['attribute']['size'], 1));
} else {
$dom[$key]['fontsize'] = intval($dom[$key]['attribute']['size']);
@@ -18548,10 +18548,10 @@ class TCPDF {
if (($dom[$key]['value'] == 'pre') OR ($dom[$key]['value'] == 'tt')) {
$dom[$key]['fontname'] = $this->default_monospaced_font;
}
if (($dom[$key]['value']{0} == 'h') AND (intval($dom[$key]['value']{1}) > 0) AND (intval($dom[$key]['value']{1}) < 7)) {
if (($dom[$key]['value'][0] == 'h') AND (intval($dom[$key]['value'][1]) > 0) AND (intval($dom[$key]['value'][1]) < 7)) {
// headings h1, h2, h3, h4, h5, h6
if (!isset($dom[$key]['attribute']['size']) AND !isset($dom[$key]['style']['font-size'])) {
$headsize = (4 - intval($dom[$key]['value']{1})) * 2;
$headsize = (4 - intval($dom[$key]['value'][1])) * 2;
$dom[$key]['fontsize'] = $dom[0]['fontsize'] + $headsize;
}
if (!isset($dom[$key]['style']['font-weight'])) {
@@ -18613,7 +18613,7 @@ class TCPDF {
}
// check for text alignment
if (isset($dom[$key]['attribute']['align']) AND (!$this->empty_string($dom[$key]['attribute']['align'])) AND ($dom[$key]['value'] !== 'img')) {
$dom[$key]['align'] = strtoupper($dom[$key]['attribute']['align']{0});
$dom[$key]['align'] = strtoupper($dom[$key]['attribute']['align'][0]);
}
// check for text rendering mode (the following attributes do not exist in HTML)
if (isset($dom[$key]['attribute']['stroke'])) {
@@ -19268,7 +19268,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
if (($stroffset !== false) AND ($stroffset <= $strpiece[2][1])) {
// set offset to the end of string section
$offset = strpos($pmid, ')]', $stroffset);
while (($offset !== false) AND ($pmid{($offset - 1)} == '\\')) {
while (($offset !== false) AND ($pmid[($offset - 1)] == '\\')) {
$offset = strpos($pmid, ')]', ($offset + 1));
}
if ($offset === false) {
@@ -19327,7 +19327,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
// justify block
if (!$this->empty_string($this->lispacer)) {
$this->lispacer = '';
continue;
continue 2;
}
preg_match('/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s](re)([\s]*)/x', $pmid, $xmatches);
$currentxpos = $xmatches[1];
@@ -20330,7 +20330,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$imglink = '';
if (isset($this->HREF['url']) AND !$this->empty_string($this->HREF['url'])) {
$imglink = $this->HREF['url'];
if ($imglink{0} == '#') {
if ($imglink[0] == '#') {
// convert url to internal link
$lnkdata = explode(',', $imglink);
if (isset($lnkdata[0])) {
@@ -25501,11 +25501,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$this->SVGTransform($tm);
$obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h);
// fix image path
if (!$this->empty_string($this->svgdir) AND (($img{0} == '.') OR (basename($img) == $img))) {
if (!$this->empty_string($this->svgdir) AND (($img[0] == '.') OR (basename($img) == $img))) {
// replace relative path with full server path
$img = $this->svgdir.'/'.$img;
}
if (($img{0} == '/') AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
if (($img[0] == '/') AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
$findroot = strpos($img, $_SERVER['DOCUMENT_ROOT']);
if (($findroot === false) OR ($findroot > 1)) {
// replace relative path with full server path