sandreas / m4b-tool

m4b-tool is a command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b
MIT License
1.18k stars 76 forks source link

Return type of M4bTool\Audio\Tag::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used #248

Closed brandonscript closed 1 year ago

brandonscript commented 1 year ago

Another error that's cropping up with just some specific files (e.g., 1 .mp3 in a folder of 50) is

an error occured, that has not been caught:
Array
(
    [type] => 8192
    [message] => Return type of M4bTool\Audio\Tag::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Audio/Tag.php
    [line] => 158
)

I believe this line: https://github.com/sandreas/m4b-tool/blob/ccfb548cda1bfc5f764771ca10d11ba153488476/src/library/Audio/Tag.php#L272

should be:

unset($this->$offset);

I can't easily test if this would stop this error, but I can reproduce it with a specific file – if there's any helpful info in the file that could help narrow down the cause, let me know.

sandreas commented 1 year ago

Another error that's cropping up with just some specific files (e.g., 1 .mp3 in a folder of 50) is

This is m4b-tool not being compatible with latest PHP versions (>= 8.1). It's pretty much work to improve this, but for your specific error, I fixed it in the latest code...

adamtiley commented 7 months ago

Hey! New to this tool but just had this same error on lastest release for Unraid.

Wondering if there's something I can do to fix? :)

brandonscript commented 7 months ago

@adamtiley the latest beta version has this fixed, so just use that

adamtiley commented 7 months ago

Good stuff, thanks for letting me know :) How do I go about installing the beta version of the Docker container with Unraid? Can't seem to find anywhere to do this. Can only see the "latest" tag

brandonscript commented 7 months ago

@adamtiley funny you should mention that, I struggled with it myself, but here's a generalized distro bash script to install it. Not sure if it'll work for Unraid, but maybe it'll help:

https://github.com/brandonscript/auto-m4b/blob/main/scripts/install-docker-m4b-tool.sh

adamtiley commented 7 months ago

Thanks that script did work and it updated the existing container image.

I tried again (and rechecked my naming on the title/file names and instead got this instead:

Starting Conversion
an error occured, that has not been caught:
Array
(
    [type] => 8192
    [message] => Return type of Symfony\Component\Process\Process::getIterator($flags = 0) should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
    [file] => phar:///usr/local/bin/m4b-tool/vendor/symfony/process/Process.php
    [line] => 609
)
Finished Converting

I'll raise a separate issue for this though.

I've checked the merged file and it does seem to work (but it's 10 hours long so I'll only really know once it's been listened to properly!)

Thanks again.