Skip to content
New issue

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

Uninitialized string offset: 35 on line 725 tcpdi_parser.php #31

Open
Manitnelav opened this issue Oct 12, 2022 · 1 comment
Open

Uninitialized string offset: 35 on line 725 tcpdi_parser.php #31

Manitnelav opened this issue Oct 12, 2022 · 1 comment

Comments

@Manitnelav
Copy link

I get this error
Uninitialized string offset: 35 application/third_party/tcpdf/tcpdi_parser.php 725

The line on 725 is in method getRawObject

while (strspn($data[$offset], "\x00\x09\x0a\x0c\x0d\x20") == 1) {
    $offset++;
}

Some idea how to change it? I don't understand what getRawObject should return in this cases.

@Abdulazeezvp
Copy link

I was able to fix the issue by adding isset and strict type checking, which seems to resolve the infinite loop. However, I'm not sure if this is the most robust solution. Here's the code I modified at line 725:

while (isset($data[$offset]) && is_string($data[$offset]) && strspn($data[$offset], "\x00\x09\x0a\x0c\x0d\x20") == 1) { $offset++; } // get first char if (isset($data[$offset]) && is_string($data[$offset])) { $char = $data[$offset]; } else { return array(array(PDF_TYPE_NULL, 'null'), $offset); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants