nextcloud / previewgenerator

Nextcloud app to do preview generation in the background.
https://apps.nextcloud.com/apps/previewgenerator
GNU Affero General Public License v3.0
455 stars 57 forks source link

Not working with php8.x #249

Closed mixim-mixim closed 2 years ago

mixim-mixim commented 3 years ago

Hi running the preview generator with php8 will fail because of a more strict type handling in 8.x (e.g. see https://github.com/JamesHeinrich/getID3/issues/299) nevertheless u may get it run correct with php7.x (hope u have php7 and php8 installed both on ur system)

sudo -u [webserver user] php7.4 ./occ preview:generate-all

replace [webserver user] with the user of your webserver (mostly www-data) Cheers. MiXiM

pachulo commented 2 years ago

Hi! @st3iny do you think it would take a lot of work to get this done? I would like to help, but sadly I don't have any PHP skills...

st3iny commented 2 years ago

I guess it will take some effort. However, I will have to do some testing and look at the code to give a good estimate. You could test the app on a PHP v8 machine and report all errors you encounter.

st3iny commented 2 years ago

@mixim-mixim Could you be more specific about the error that occurred? I just tested using PHP v8.0.12 on Nextcloud v22 and both commands (preview:generate-all, preview:pre-generate) worked fine. There were no error reported in the log.

pauloriply commented 2 years ago

NC version - 22 Installation method - docker compose php version on app container - 8.0.12

When run sudo docker exec -u www-data -it cloud_app_1 ./occ preview:generate-all Result is:

An unhandled exception has been thrown:
TypeError: decbin(): Argument #1 ($num) must be of type int, string given in /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/getid3_lib.php:305
Stack trace:
#0 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/getid3_lib.php(305): decbin('.P')
#1 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/Tags/getid3_id3v2.php(1873): ID3Parser\getID3\getid3_lib::Dec2Bin('.P')
#2 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/Tags/getid3_id3v2.php(338): ID3Parser\getID3\Tags\getid3_id3v2->ParseID3v2Frame(Array)
#3 /var/www/html/3rdparty/christophwurst/id3parser/src/getID3/getid3.php(164): ID3Parser\getID3\Tags\getid3_id3v2->Analyze()
#4 /var/www/html/3rdparty/christophwurst/id3parser/src/ID3Parser.php(20): ID3Parser\getID3\getid3->analyze('/var/www/html/d...')
#5 /var/www/html/lib/private/Preview/MP3.php(51): ID3Parser\ID3Parser->analyze('/var/www/html/d...')
#6 /var/www/html/lib/private/Preview/GeneratorHelper.php(62): OC\Preview\MP3->getThumbnail(Object(OC\Files\Node\File), 4096, 4096)
#7 /var/www/html/lib/private/Preview/Generator.php(245): OC\Preview\GeneratorHelper->getThumbnail(Object(OC\Preview\MP3), Object(OC\Files\Node\File), 4096, 4096)
#8 /var/www/html/lib/private/Preview/Generator.php(140): OC\Preview\Generator->getMaxPreview(Object(OC\Files\SimpleFS\SimpleFolder), Object(OC\Files\Node\File), 'audio/mpeg', '')
#9 /var/www/html/lib/private/PreviewManager.php(204): OC\Preview\Generator->generatePreviews(Object(OC\Files\Node\File), Array, 'audio/mpeg')
#10 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(203): OC\PreviewManager->generatePreviews(Object(OC\Files\Node\File), Array)
#11 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(174): OCA\PreviewGenerator\Command\Generate->parseFile(Object(OC\Files\Node\File))
#12 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder(Object(OC\Files\Node\Folder))
#13 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder(Object(OC\Files\Node\Folder))
#14 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(155): OCA\PreviewGenerator\Command\Generate->parseFolder(Object(OC\Files\Node\Folder))
#15 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(123): OCA\PreviewGenerator\Command\Generate->generateUserPreviews(Object(OC\User\User))
#16 /var/www/html/lib/private/User/Manager.php(646): OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}(Object(OC\User\User))
#17 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(124): OC\User\Manager->callForSeenUsers(Object(Closure))
#18 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\PreviewGenerator\Command\Generate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\PreviewGenerator\Command\Generate), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/console.php(99): OC\Console\Application->run()
#24 /var/www/html/occ(11): require_once('/var/www/html/c...')
#25 {main}
st3iny commented 2 years ago

Thanks for the error log. This needs to be fixed at https://github.com/ChristophWurst/ID3Parser. The problem is not in the PreviewGenerator app itself but in the core preview logic/ID3Parser library, as you can clearly see.

Unfortunately, I can't fix it here but I will delegate this issue.

ghost commented 2 years ago

Possible link to #263 ?

st3iny commented 2 years ago

The fix got merged and will be included in the next update release of Nextcloud v23.