Skip to content

Commit f1a7eb3

Browse files
authored
Merge pull request #4 from ohgoodlord/feature/fix-array-access
PHP 7.4 - Fix deprecated array access
2 parents 80c9fd4 + bb364af commit f1a7eb3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tcpdf/tcpdi_parser.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,11 @@ protected function getRawObject($offset=0, $data=null) {
722722
$objtype = ''; // object type to be returned
723723
$objval = ''; // object value to be returned
724724
// skip initial white space chars: \x00 null (NUL), \x09 horizontal tab (HT), \x0A line feed (LF), \x0C form feed (FF), \x0D carriage return (CR), \x20 space (SP)
725-
while (strspn($data{$offset}, "\x00\x09\x0a\x0c\x0d\x20") == 1) {
725+
while (strspn($data[$offset], "\x00\x09\x0a\x0c\x0d\x20") == 1) {
726726
$offset++;
727727
}
728728
// get first char
729-
$char = $data{$offset};
729+
$char = $data[$offset];
730730
// get object type
731731
switch ($char) {
732732
case '%': { // \x25 PERCENT SIGN
@@ -757,10 +757,10 @@ protected function getRawObject($offset=0, $data=null) {
757757
if ($char == '(') {
758758
$open_bracket = 1;
759759
while ($open_bracket > 0) {
760-
if (!isset($data{$strpos})) {
760+
if (!isset($data[$strpos])) {
761761
break;
762762
}
763-
$ch = $data{$strpos};
763+
$ch = $data[$strpos];
764764
switch ($ch) {
765765
case '\\': { // REVERSE SOLIDUS (5Ch) (Backslash)
766766
// skip next character
@@ -828,7 +828,7 @@ protected function getRawObject($offset=0, $data=null) {
828828
break;
829829
}
830830
default: {
831-
$frag = $data{$offset} . @$data{$offset+1} . @$data{$offset+2} . @$data{$offset+3};
831+
$frag = $data[$offset] . @$data[$offset+1] . @$data[$offset+2] . @$data[$offset+3];
832832
switch ($frag) {
833833
case 'endo':
834834
// indirect object
@@ -905,16 +905,16 @@ private function getDictValue($offset, &$data) {
905905
$dict = '';
906906
$offset += 2;
907907
do {
908-
if ($data{$offset} == '>' && $data{$offset+1} == '>') {
908+
if ($data[$offset] == '>' && $data[$offset+1] == '>') {
909909
$i--;
910910
$dict .= '>>';
911911
$offset += 2;
912-
} else if ($data{$offset} == '<' && $data{$offset+1} == '<') {
912+
} else if ($data[$offset] == '<' && $data[$offset+1] == '<') {
913913
$i++;
914914
$dict .= '<<';
915915
$offset += 2;
916916
} else {
917-
$dict .= $data{$offset};
917+
$dict .= $data[$offset];
918918
$offset++;
919919
}
920920
} while ($i>0);

0 commit comments

Comments
 (0)