Closed cospin closed 11 months ago
Thanks, I will fix this today 👍
Can you check latest version?
@ewilan-riviere unfortunately, I found another file that gives a similar error, but this time it's Call to a member function genre() on null
. I suppose we need to make sure that $v2 exists in every field, not just in the comment field.
To be honest, it's somewhat unusual, and without looking at the code a bit, I wouldn't know why it's happening. It's supposed to be the case that $v2 should never be null in fromId3(?Id3AudioTagV1 $v1, Id3AudioTagV2 $v2)
, and the trace shows that it's called with $v2: fromId3(NULL, Object(Kiwilan\Audio\Models\Id3AudioTagV2))
This time, it happened with a Tag ID3v2.4 (ID3v2.4), which has several empty fields, including the genre.
Checking for $v2 as we do with comment works, but seems weird to have to check $v2 on every field.
I will fix this, if you have a sample to provide for tests (if you can share it), it would be great!
Thanks! Can I let these files into tests files?
No, they are not mine and have copyright 🙃 Let me know if you have downloaded them so I can remove the link.
No problem, I will create sample from their metadata. Yes, you can remove it
Can you test with latest version?
Yep, seems to work fine. Thank you! 🙏
No problem, tell me if you find another bug!
What happened?
It seems that when an .mp3 file only has ID3v2 information and no v1, the following error is generated:
The relevant line is: https://github.com/kiwilan/php-audio/blob/327e76d9e7c1e1cb6d2d950617f8dce2ffd88967/src/Models/AudioCore.php#L430 In this case, the function is being called as:
fromId3(NULL, Object)
. Replacing the line with:comment: $v2 ? $v2->comment() : $v1->comment()
, works.How to reproduce the bug
For now I think it happens when a .mp3 file only has only ID3v2 information and no v1.
Package Version
3.0.02
PHP Version
8.2.11
Which operating systems does with happen with?
Windows
Notes
Really nice work, thank you!