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

Trying to access array offset on value of type int #365

Closed
QuixThe2nd opened this issue Jan 3, 2022 · 6 comments
Closed

Trying to access array offset on value of type int #365

QuixThe2nd opened this issue Jan 3, 2022 · 6 comments
Labels

Comments

@QuixThe2nd
Copy link

Im getting the following error:
Trying to access array offset on value of type int
on line 29 of getID3/getid3.lib.php

PHP Version: 8

@StudioMaX StudioMaX added bug A bug report sample needed labels Jan 3, 2022
@StudioMaX
Copy link
Collaborator

A warning in this place can occur in many cases, most likely there is something wrong with the analyzed files.
Please attach a link to the problem file here, or send it to info@getid3.org

@QuixThe2nd
Copy link
Author

@JamesHeinrich
Copy link
Owner

The provided sample seems to be a normal zip file structure. I did not encounter any errors or warnings on PHP v8.0.11 or v7.4.1

@QuixThe2nd
Copy link
Author

Im getting it on PHP 8.0.14

@StudioMaX
Copy link
Collaborator

Looks like this warning going from that condition

$LocalFileHeader['data_descriptor']['signature'] = getid3_lib::LittleEndian2Int(substr($DataDescriptor, 0, 4));
if ($LocalFileHeader['data_descriptor']['signature'] != 0x08074B50) { // "PK\x07\x08"
$this->getid3->warning('invalid Local File Header Data Descriptor Signature at offset '.($this->ftell() - 16).' - expecting 08 07 4B 50, found '.getid3_lib::PrintHexBytes($LocalFileHeader['data_descriptor']['signature']));
$this->fseek($LocalFileHeader['offset']); // seek back to where filepointer originally was so it can be handled properly
return false;
}

$LocalFileHeader['data_descriptor']['signature'] in this case is (int) 3528876101/ 0xD2566045 instead of expected 0x08074B50. Therefore, the signature is passed as an integer to PrintHexBytes, which expects a string.

@JamesHeinrich
Copy link
Owner

This slightly inelegant change should fix it I think?
e1e92b1

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

No branches or pull requests

3 participants