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

Incorrect string attribution breaking with PHP 7.1 #123

Closed
rseabra opened this issue Jan 22, 2017 · 11 comments
Closed

Incorrect string attribution breaking with PHP 7.1 #123

rseabra opened this issue Jan 22, 2017 · 11 comments
Milestone

Comments

@rseabra
Copy link

rseabra commented Jan 22, 2017

Expected behavior

No PHP stack trace.

Actual behavior

PHP stack trace and not files scanned.

Start scan for USER
An unhandled exception has been thrown:
Error: [] operator not supported for strings in /var/www/html/nextcloud/apps/audioplayer/3rdparty/getid3/module.audio.mp3.php:926
Stack trace:
#0 /var/www/html/nextcloud/apps/audioplayer/3rdparty/getid3/module.audio.mp3.php(1088): getid3_mp3->decodeMPEGaudioHeader(572, Array, false)
#1 /var/www/html/nextcloud/apps/audioplayer/3rdparty/getid3/module.audio.mp3.php(973): getid3_mp3->RecursiveFrameScanning(572, 989, false)
#2 /var/www/html/nextcloud/apps/audioplayer/3rdparty/getid3/module.audio.mp3.php(1430): getid3_mp3->decodeMPEGaudioHeader(572, Array, true)
#3 /var/www/html/nextcloud/apps/audioplayer/3rdparty/getid3/module.audio.mp3.php(35): getid3_mp3->getOnlyMPEGaudioInfo(572)
#4 /var/www/html/nextcloud/apps/audioplayer/3rdparty/getid3/getid3.php(463): getid3_mp3->Analyze()
#5 /var/www/html/nextcloud/apps/audioplayer/controller/scannercontroller.php(541): getID3->analyze('/var/lib/cloud/...')
#6 /var/www/html/nextcloud/apps/audioplayer/command/scan.php(87): OCA\audioplayer\Controller\ScannerController->scanForAudios('USER', Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#7 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(256): OCA\audioplayer\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(818): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(OCA\audioplayer\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/nextcloud/lib/private/Console/Application.php(169): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/nextcloud/console.php(90): OC\Console\Application->run()
#13 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')
#14 {main}

Steps to reproduce the behavior

  1. sudo -u apache php occ audioplayer:scan USER (or --all)

Possible solution (optional)

grep -r '][]' * | cut -d : -f 1 | sort -u | while read F ; do sed -i -e 's,][],],' $F ; done
sudo -u apache php occ audioplayer:scan USER
Start scan for USER
Audios found: 1302
Duplicates found: 0
Written to music library: 1300
Albums found: 0
Errors: 2

Server configuration

Operating system:
CentOS 7

Web server:

Apache 2.4

PHP version:

7.1

ownCloud/Nextcloud version: (see /status.php)

11 and 11.0.1

Audio Player version: (see /settings/apps)

1.4.0

Where did you install Audio Player from:

Apps in Nextcloud

@rseabra
Copy link
Author

rseabra commented Jan 22, 2017

There are more points of contention, audioplayer now scans, but it's still not working with the same issue on other places:

{"reqId":"WIR7X8YGIWAuDMbNKNZZrAAAAAA","remoteAddr":"192.168.3.30","app":"index","message":"Exception: {"Exception":"Error","Message":"[] operator not supported for strings","Code":0,"Trace":"#0 \/var\/www\/html\/nextcloud\/apps\/audioplayer\/controller\/categorycontroller.php(61): OCA\\audioplayer\\Controller\\CategoryController->getCategoryforUser('Folder')\n#1 [internal function]: OCA\\audioplayer\\Controller\\CategoryController->getCategory()\n#2 \/var\/www\/html\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(160): call_user_func_array(Array, Array)\n#3 \/var\/www\/html\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(90): OC\\AppFramework\\Http\\Dispatcher->executeController(Object(OCA\\audioplayer\\Controller\\CategoryController), 'getCategory')\n#4 \/var\/www\/html\/nextcloud\/lib\/private\/AppFramework\/App.php(114): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OCA\\audioplayer\\Controller\\CategoryController), 'getCategory')\n#5 \/var\/www\/html\/nextcloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(47): OC\\AppFramework\\App::main('OCA\\\\audioplayer...', 'getCategory', Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)\n#6 [internal function]: OC\\AppFramework\\Routing\\RouteActionHandler->__invoke(Array)\n#7 \/var\/www\/html\/nextcloud\/lib\/private\/Route\/Router.php(299): call_user_func(Object(OC\\AppFramework\\Routing\\RouteActionHandler), Array)\n#8 \/var\/www\/html\/nextcloud\/lib\/base.php(1010): OC\\Route\\Router->match('\/apps\/audioplay...')\n#9 \/var\/www\/html\/nextcloud\/index.php(40): OC::handleRequest()\n#10 {main}","File":"\/var\/www\/html\/nextcloud\/apps\/audioplayer\/controller\/categorycontroller.php","Line":135}","level":3,"time":"2017-01-22T09:29:03+00:00","method":"GET","url":"/index.php/apps/audioplayer/getcategory?category=Folder","user":"USER","version":"11.0.1.2"}

But the pattern here is't $var[...][] = "string" but probably $var[]="string" OR the script above did a bit more than it should :)

However I verified by uninstalling audioplayer and reinstalling it again, after the successful scan, that the [] problem persists with original untouched code.

@rseabra
Copy link
Author

rseabra commented Jan 22, 2017

DON'T RUN THE "fix", it does make scan run but it indeed breaks things up, I've cleared the tables and scanned again and noticed that artists and albums wasn't being populated with errors on the nextcloud.log about invalid arguments to foreach so... yeah, a more troublesome manual fix might be needed :)

@Rello
Copy link
Owner

Rello commented Jan 22, 2017

Hello @rseabra
what do you mean by "DON'T RUN THE "fix""
did you install the current beta from GIT with the already fixed getID3?

@rseabra
Copy link
Author

rseabra commented Jan 22, 2017

Hi @Rello,

The "fix" that's in the bug report. The issue happens also outside of the third party id3 library.

For now I'm "fixing" it more successfully with

grep -r 'error.][]' * | cut -d : -f 1 | sort -u | while read F ; do sed -i -e "s,error'][] =,error'] =," $F ; done
grep -r 'warning.
][]' * | cut -d : -f 1 | sort -u | while read F ; do sed -i -e "s,warning'][] =,warning'] =," $F ; done

But there are still errors like:
{"reqId":"2ZDJLRdL7le6AGV81DCJ","remoteAddr":"","app":"PHP","message":"array_values() expects parameter 1 to be array, null given at /var/www/html/nextcloud/apps/audioplayer/3rdparty/getid3/getid3.php#561","level":3,"time":"2017-01-22T10:08:32+00:00","method":"--","url":"--","user":"--","version":"11.0.1.2"}

These maybe are from those with the fix you mention.

Do you have any eta for a fixed version of audioplayer?

@Rello
Copy link
Owner

Rello commented Jan 22, 2017

Hello,
if you are able to assist with testing, it would be a great help. I habe issues with my php7.1 because it is not yet available for my Raspberries I use for testing.

if you download the current repo directly from GIT and copy/paste it into your /apps folder, you could give it a try. its flagged as 1.4.1-beta.2

  • it should hopefully cover all getID3 stuff.
  • your second post is up to me. I need to have a look there because thats my own

@ghost
Copy link

ghost commented Jan 22, 2017

if you download the current repo directly from GIT

git clone https://github.com/rello/audioplayer.git audioplayer in /apps works. ;-)

@rseabra
Copy link
Author

rseabra commented Jan 22, 2017

Will do and report back.

@rseabra
Copy link
Author

rseabra commented Jan 22, 2017

BTW, this is one such example:

{"reqId":"WISSDdBIC5ZL7-A39oczJgAAAAQ","remoteAddr":"192.168.3.30","app":"index","message":"Exception: {"Exception":"Error","Message":"Cannot use string offset as an array","Code":0,"Trace":"#0 \/var\/www\/html\/nextcloud\/apps\/audioplayer\/controller\/musiccontroller.php(160): OCA\\audioplayer\\Controller\\MusicController->loadSongs()\n#1 [internal function]: OCA\\audioplayer\\Controller\\MusicController->getMusic()\n#2 \/var\/www\/html\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(160): call_user_func_array(Array, Array)\n#3 \/var\/www\/html\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(90): OC\\AppFramework\\Http\\Dispatcher->executeController(Object(OCA\\audioplayer\\Controller\\MusicController), 'getMusic')\n#4 \/var\/www\/html\/nextcloud\/lib\/private\/AppFramework\/App.php(114): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OCA\\audioplayer\\Controller\\MusicController), 'getMusic')\n#5 \/var\/www\/html\/nextcloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(47): OC\\AppFramework\\App::main('OCA\\\\audioplayer...', 'getMusic', Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)\n#6 [internal function]: OC\\AppFramework\\Routing\\RouteActionHandler->__invoke(Array)\n#7 \/var\/www\/html\/nextcloud\/lib\/private\/Route\/Router.php(299): call_user_func(Object(OC\\AppFramework\\Routing\\RouteActionHandler), Array)\n#8 \/var\/www\/html\/nextcloud\/lib\/base.php(1010): OC\\Route\\Router->match('\/apps\/audioplay...')\n#9 \/var\/www\/html\/nextcloud\/index.php(40): OC::handleRequest()\n#10 {main}","File":"\/var\/www\/html\/nextcloud\/apps\/audioplayer\/controller\/musiccontroller.php","Line":273}","level":3,"time":"2017-01-22T11:05:49+00:00","method":"GET","url":"/index.php/apps/audioplayer/getmusic","user":"USER","version":"11.0.1.2"}

And audioplayer just shows a spinning wheel on center of the page and no albums show up.

@rseabra
Copy link
Author

rseabra commented Jan 22, 2017

Yeah, it works! Even the one on your "side" works, @Rello . Thanks for fixing it.

How do git downloaded apps interact with Nextcloud's app management? When a new stable comes out, will it offer me to "update" to it?

@rseabra
Copy link
Author

rseabra commented Jan 22, 2017

Well, fixing this one lead to opening #124 as a performance issue.

I'd like to help more, but I'm not experienced enough in PHP for this sort of thing, only hackish stuff like those greps :)

@Rello
Copy link
Owner

Rello commented Jan 22, 2017

hello,
yes, also the own code was fixed because there was a commit already applied to get the array sorted out. almost forgot already :-)

the version management will be fine because now you have a ...beta2 installed.
As soon as we push the official 1.4.1 the app store will recognize and offer as a normal app update.

thank you very much for your testing support. helped a lot

@Rello Rello closed this as completed Jan 22, 2017
@Rello Rello added this to the 1.4.1 milestone Jan 22, 2017
@ghost ghost changed the title Incorrect string attribution breaking with PHP 7.1 (maybe others): don't use $string[]="value" Incorrect string attribution breaking with PHP 7.1 Jan 22, 2017
@ghost ghost reopened this Jan 22, 2017
@ghost ghost added pending release and removed pending release labels Jan 22, 2017
@ghost ghost closed this as completed Jan 26, 2017
This issue was closed.
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