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
Hi,
using this module in OXID Version 6.3.0 with the PHP Version 8.0.3 several fatal incompatibility errors occurs.
[27 Apr 07:45:13.589143 2021] [uncaught error] [type E_COMPILE_ERROR] [file .../httpdocs_oxid_project_ce/source/modules/oe/invoicepdf/core/invoicepdfpdf.php] [line 274] [code ] [message Array and string offset access syntax with curly braces is no lo nger supported]
The following patch will solve the issues:
diff -Nur a/vendor/oxid-projects/pdf-invoice-module/core/invoicepdfpdf.php b/vendor/oxid-projects/pdf-invoice-module/core/invoicepdfpdf.php --- a/vendor/oxid-projects/pdf-invoice-module/core/invoicepdfpdf.php 2021-03-16 13:01:27.000000000 +0100 +++ b/vendor/oxid-projects/pdf-invoice-module/core/invoicepdfpdf.php 2021-04-27 07:46:57.822246187 +0200 @@ -207,7 +207,7 @@ /** * TCPDF class wrapper, set/overrides oxid specific functionality - * + * * @deprecated since v5.3 (2016-08-06); class will be moved to the InvoicePDF module. */ class InvoicepdfPDF extends \TCPDF @@ -271,7 +271,7 @@ } } else { //Tag - if ($e{0} == '/') { + if ($e[0] == '/') { $this->CloseTag(strtoupper(substr($e, 1))); } else { //Extract attributes diff -Nur a/vendor/oxid-projects/pdf-invoice-module/core/tcpdf/tcpdf.php b/vendor/oxid-projects/pdf-invoice-module/core/tcpdf/tcpdf.php --- a/vendor/oxid-projects/pdf-invoice-module/core/tcpdf/tcpdf.php 2021-03-16 13:01:27.000000000 +0100 +++ b/vendor/oxid-projects/pdf-invoice-module/core/tcpdf/tcpdf.php 2021-04-27 07:56:21.761472589 +0200 @@ -6311,12 +6311,12 @@ $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)); } @@ -7405,7 +7405,7 @@ $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['_'.$str] = $strarr; @@ -7417,7 +7417,7 @@ $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) { $unicode[] = $char; // use the character "as is" because is ASCII @@ -7659,7 +7659,7 @@ * @access public */ public function addHtmlLink($url, $name, $fill=0, $firstline=false, $color='', $style=-1) { - if (!$this->empty_string($url) AND ($url{0} == '#')) { + if (!$this->empty_string($url) AND ($url[0] == '#')) { // convert url to internal link $page = intval(substr($url, 1)); $url = $this->AddLink(); @@ -7807,7 +7807,7 @@ $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; } @@ -7827,7 +7827,7 @@ $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; } @@ -11867,7 +11867,7 @@ $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); @@ -11918,7 +11918,7 @@ case 'V': case 'L': case 'C': { - $line{$len-1} = strtolower($cmd); + $line[$len-1] = strtolower($cmd); $this->_out($line); break; } @@ -12632,7 +12632,7 @@ $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; @@ -12642,7 +12642,7 @@ } $dom[$key]['tag'] = true; $dom[$key]['value'] = $tagname; - if ($element{0} == '/') { + if ($element[0] == '/') { // closing html tag $dom[$key]['opening'] = false; $dom[$key]['parent'] = end($level); @@ -12793,10 +12793,10 @@ } } // 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 @@ -12813,9 +12813,9 @@ foreach ($decors as $dec) { $dec = trim($dec); if (!$this->empty_string($dec)) { - if ($dec{0} == 'u') { + if ($dec[0] == 'u') { $dom[$key]['fontstyle'] .= 'U'; - } elseif ($dec{0} == 'l') { + } elseif ($dec[0] == 'l') { $dom[$key]['fontstyle'] .= 'D'; } } @@ -12831,7 +12831,7 @@ } // 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 border attribute if (isset($dom[$key]['style']['border'])) { @@ -12854,9 +12854,9 @@ // 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']); @@ -12893,8 +12893,8 @@ 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)) { - $headsize = (4 - intval($dom[$key]['value']{1})) * 2; + if (($dom[$key]['value'][0] == 'h') AND (intval($dom[$key]['value'][1]) > 0) AND (intval($dom[$key]['value'][1]) < 7)) { + $headsize = (4 - intval($dom[$key]['value'][1])) * 2; $dom[$key]['fontsize'] = $dom[0]['fontsize'] + $headsize; $dom[$key]['fontstyle'] .= 'B'; } @@ -12942,7 +12942,7 @@ } // 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]); } } // end opening tag } else { @@ -13327,7 +13327,7 @@ 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) { @@ -13985,9 +13985,9 @@ foreach ($decors as $dec) { $dec = trim($dec); if (!$this->empty_string($dec)) { - if ($dec{0} == 'u') { + if ($dec[0] == 'u') { $this->HREF['style'] .= 'U'; - } elseif ($dec{0} == 'l') { + } elseif ($dec[0] == 'l') { $this->HREF['style'] .= 'D'; } } @@ -14049,7 +14049,7 @@ $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 $page = intval(substr($imglink, 1)); $imglink = $this->AddLink(); diff -Nur a/vendor/oxid-projects/pdf-invoice-module/models/invoicepdfoxorder.php b/vendor/oxid-projects/pdf-invoice-module/models/invoicepdfoxorder.php --- a/vendor/oxid-projects/pdf-invoice-module/models/invoicepdfoxorder.php 2021-03-16 13:01:27.000000000 +0100 +++ b/vendor/oxid-projects/pdf-invoice-module/models/invoicepdfoxorder.php 2021-04-27 14:50:53.143094517 +0200 @@ -672,7 +672,7 @@ $aTransTbl = array_flip($aTransTbl) + array_flip($aReplace); $sValue = strtr($sValue, $aTransTbl); - $sValue = getStr()->preg_replace_callback('/\&\#([0-9]+)\;/m', create_function('$matches', "return chr(\$matches[1]);") , $sValue); + $sValue = getStr()->preg_replace_callback('/\&\#([0-9]+)\;/m', function ($matches) { return chr($matches[1]); }, $sValue); } return $sValue;
The text was updated successfully, but these errors were encountered:
@weber-ebusiness Thank you, can you please make a PullRequest instead of a patch.
Sorry, something went wrong.
ok, the pull request is done: #31
No branches or pull requests
Hi,
using this module in OXID Version 6.3.0 with the PHP Version 8.0.3 several fatal incompatibility errors occurs.
The following patch will solve the issues:
The text was updated successfully, but these errors were encountered: