Solved: Exception while scanning: array_merge(): Argument #2 is not an array

9.1.x

#1

Steps to reproduce
1.
2.
3.

Expected behaviour
files:scan --all should be run without errors

Actual behaviour

I get the following errors:

root@cubietruck:/srv/secure/owncloud# sudo -u www-data php /srv/secure/owncloud/occ files:scan --all -vvv

Scanning files for 6 users

Starting scan for user 1 out of 6 (Alex)
        Folder /Alex/
Exception while scanning: array_merge(): Argument #2 is not an array
#0 [internal function]: OCA\Files\Command\Scan->exceptionErrorHandler(2, 'array_merge(): ...', '/srv/secure/own...', 99, Array)                                                                                  
#1 /srv/secure/owncloud/lib/private/Files/Type/Detection.php(99): array_merge(Array, NULL)                                                                                                                       
#2 /srv/secure/owncloud/lib/private/Files/Type/Detection.php(147): OC\Files\Type\Detection->registerTypeArray(NULL)                                                                                              
#3 /srv/secure/owncloud/lib/private/Files/Type/Detection.php(165): OC\Files\Type\Detection->loadMappings()                                                                                                       
#4 /srv/secure/owncloud/lib/private/Files/Storage/Common.php(232): OC\Files\Type\Detection->detectPath('avatar.32.png')                                                                                          
#5 /srv/secure/owncloud/lib/private/Files/Storage/Common.php(644): OC\Files\Storage\Common->getMimeType('avatar.32.png')                                                                                         
#6 /srv/secure/owncloud/lib/private/Files/Storage/Wrapper/Encryption.php(172): OC\Files\Storage\Common->getMetaData('avatar.32.png')                                                                             
#7 /srv/secure/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(572): OC\Files\Storage\Wrapper\Encryption->getMetaData('avatar.32.png')                                                                    
#8 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(113): OC\Files\Storage\Wrapper\Wrapper->getMetaData('avatar.32.png')                                                                                 
#9 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(145): OC\Files\Cache\Scanner->getData('avatar.32.png')                                                                                               
#10 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(409): OC\Files\Cache\Scanner->scanFile('avatar.32.png', 3, '10435', Object(OC\Files\Cache\CacheEntry), true)                                        
#11 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(377): OC\Files\Cache\Scanner->handleChildren('', true, 3, '10435', true, 0)                                                                         
#12 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(311): OC\Files\Cache\Scanner->scanChildren('', true, 3, 10435, true)                                                                                
#13 /srv/secure/owncloud/lib/private/Files/Utils/Scanner.php(217): OC\Files\Cache\Scanner->scan('', true, 3)                                                                                                     
#14 /srv/secure/owncloud/apps/files/lib/Command/Scan.php(158): OC\Files\Utils\Scanner->scan('/Alex')                                                                                                             
#15 /srv/secure/owncloud/apps/files/lib/Command/Scan.php(226): OCA\Files\Command\Scan->scanFiles('Alex', '/Alex', true, Object(Symfony\Component\Console\Output\ConsoleOutput), false)                           
#16 /srv/secure/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))                                                                                                                                                                                                            
#17 /srv/secure/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))   
#18 /srv/secure/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))     
#19 /srv/secure/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))                                                                                                                                                            
#20 /srv/secure/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))                                                                                                                                                                                                   
#21 /srv/secure/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(NULL, NULL)                                                                                        
#22 /srv/secure/owncloud/console.php(102): OC\Console\Application->run()                                                                                                                                         
#23 /srv/secure/owncloud/occ(11): require_once('/srv/secure/own...')                                                                                                                                             
#24 {main} ...

Server configuration
Operating system: Debian GNU/Linux 8.7 (jessie)
Web server: nginx/1.6.2
Database: mysql Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (armv7l) using readline 6.3
PHP version: PHP 5.6.30-0+deb8u1 (cli)
ownCloud version (see ownCloud admin page): ownCloud 9.1.4 (stable)
Updated from an older ownCloud or fresh install: UPDATE, but got the errors later
Special configuration:
external storage: yes -> hdd mount point for user-files

ownCloud log (data/owncloud.log)

{"reqId":"dG6x7IsmKa3R3K0oq3st","remoteAddr":"","app":"no app in context","message":"Invalidating tokens older than 2017-03-26T17:30:03+00:00","level":1,"time":"2017-03-27T17:30:03+00:00","method":"--","url":"--","user":"--"}
{"reqId":"7IPi2RgMVY8GYY426qnV","remoteAddr":"","app":"no app in context","message":"Invalidating tokens older than 2017-03-26T17:45:03+00:00","level":1,"time":"2017-03-27T17:45:03+00:00","method":"--","url":"--","user":"--"}
{"reqId":"F6VLci0\/UKCx\/H4IZvDv","remoteAddr":"","app":"no app in context","message":"Invalidating tokens older than 2017-03-26T18:00:04+00:00","level":1,"time":"2017-03-27T18:00:04+00:00","method":"--","url":"--","user":"--"}
{"reqId":"sN7FEg4WLxFyI+RzNGHo","remoteAddr":"176.10.54.184","app":"PHP","message":"array_merge(): Argument #2 is not an array at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#99","level":3,"time":"2017-03-27T19:13:21+00:00","method":"GET","url":"\/owncloud\/remote.php\/webdav\/Server-rico\/GPX\/2017_03_25_M%C3%BChlbergtour.gpx","user":"Enrico"}
{"reqId":"sN7FEg4WLxFyI+RzNGHo","remoteAddr":"176.10.54.184","app":"PHP","message":"Invalid argument supplied for foreach() at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#102","level":3,"time":"2017-03-27T19:13:21+00:00","method":"GET","url":"\/owncloud\/remote.php\/webdav\/Server-rico\/GPX\/2017_03_25_M%C3%BChlbergtour.gpx","user":"Enrico"}
{"reqId":"PO4Z1b9IvVZxOQ9uSvDb","remoteAddr":"176.10.54.184","app":"PHP","message":"array_merge(): Argument #2 is not an array at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#99","level":3,"time":"2017-03-27T19:13:28+00:00","method":"GET","url":"\/owncloud\/remote.php\/webdav\/Server-rico\/GPX\/2017_03_25_M%C3%BChlbergtour.gpx","user":"Enrico"}
{"reqId":"PO4Z1b9IvVZxOQ9uSvDb","remoteAddr":"176.10.54.184","app":"PHP","message":"Invalid argument supplied for foreach() at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#102","level":3,"time":"2017-03-27T19:13:28+00:00","method":"GET","url":"\/owncloud\/remote.php\/webdav\/Server-rico\/GPX\/2017_03_25_M%C3%BChlbergtour.gpx","user":"Enrico"}
{"reqId":"JGuOa1XgEyk0TCNZDaZ8","remoteAddr":"","app":"PHP","message":"file_put_contents(\/srv\/secure\/owncloud\/core\/js\/mimetypelist.js): failed to open stream: Permission denied at \/srv\/secure\/owncloud\/core\/Command\/Maintenance\/Mimetype\/UpdateJS.php#125","level":3,"time":"2017-03-27T19:19:04+00:00","method":"--","url":"--","user":"--"}
{"reqId":"g3QgTbl4MuUz3n6ml\/RJ","remoteAddr":"","app":"PHP","message":"array_merge(): Argument #2 is not an array at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#99","level":3,"time":"2017-03-27T19:19:20+00:00","method":"--","url":"--","user":"--"}
{"reqId":"g3QgTbl4MuUz3n6ml\/RJ","remoteAddr":"","app":"PHP","message":"Invalid argument supplied for foreach() at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#102","level":3,"time":"2017-03-27T19:19:20+00:00","method":"--","url":"--","user":"--"}
{"reqId":"g3QgTbl4MuUz3n6ml\/RJ","remoteAddr":"","app":"PHP","message":"Invalid argument supplied for foreach() at \/srv\/secure\/owncloud\/core\/Command\/Maintenance\/Mimetype\/UpdateDB.php#70","level":3,"time":"2017-03-27T19:19:20+00:00","method":"--","url":"--","user":"--"}
{"reqId":"0K2jOjCcWEYTCetJcLhC","remoteAddr":"176.10.54.184","app":"PHP","message":"array_merge(): Argument #2 is not an array at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#99","level":3,"time":"2017-03-27T19:20:37+00:00","method":"GET","url":"\/owncloud\/remote.php\/webdav\/Server-rico\/GPX\/2017-03-04_K%C3%B6nigsee.gpx","user":"Enrico"}
{"reqId":"0K2jOjCcWEYTCetJcLhC","remoteAddr":"176.10.54.184","app":"PHP","message":"Invalid argument supplied for foreach() at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#102","level":3,"time":"2017-03-27T19:20:37+00:00","method":"GET","url":"\/owncloud\/remote.php\/webdav\/Server-rico\/GPX\/2017-03-04_K%C3%B6nigsee.gpx","user":"Enrico"}
{"reqId":"kXsJ3KJ7Md9ALCqbByNu","remoteAddr":"176.10.54.184","app":"PHP","message":"array_merge(): Argument #2 is not an array at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#99","level":3,"time":"2017-03-27T19:27:05+00:00","method":"GET","url":"\/owncloud\/remote.php\/webdav\/Server-rico\/GPX\/2016-09-03-Fitnessrunde.gpx","user":"Enrico"}
{"reqId":"kXsJ3KJ7Md9ALCqbByNu","remoteAddr":"176.10.54.184","app":"PHP","message":"Invalid argument supplied for foreach() at \/srv\/secure\/owncloud\/lib\/private\/Files\/Type\/Detection.php#102","level":3,"time":"2017-03-27T19:27:05+00:00","method":"GET","url":"\/owncloud\/remote.php\/webdav\/Server-rico\/GPX\/2016-09-03-Fitnessrunde.gpx","user":"Enrico"}
root@cubietruck:/srv/ocdata#

Please paste possible errors in the following code block, see https://central.owncloud.org/t/how-to-find-webserver-or-oc-logfile-enable-php-logfile/808 for more info

root@cubietruck:/srv/ocdata# sudo -u www-data php /srv/secure/owncloud/occ files:scan --all -vvv
Scanning files for 6 users
Starting scan for user 1 out of 6 (Alex)
        Folder /Alex/
Exception while scanning: array_merge(): Argument #2 is not an array
#0 [internal function]: OCA\Files\Command\Scan->exceptionErrorHandler(2, 'array_merge(): ...', '/srv/secure/own...', 99, Array)                                                                                  
#1 /srv/secure/owncloud/lib/private/Files/Type/Detection.php(99): array_merge(Array, NULL)                                                                                                                       
#2 /srv/secure/owncloud/lib/private/Files/Type/Detection.php(147): OC\Files\Type\Detection->registerTypeArray(NULL)                                                                                              
#3 /srv/secure/owncloud/lib/private/Files/Type/Detection.php(165): OC\Files\Type\Detection->loadMappings()                                                                                                       
#4 /srv/secure/owncloud/lib/private/Files/Storage/Common.php(232): OC\Files\Type\Detection->detectPath('avatar.32.png')                                                                                          
#5 /srv/secure/owncloud/lib/private/Files/Storage/Common.php(644): OC\Files\Storage\Common->getMimeType('avatar.32.png')                                                                                         
#6 /srv/secure/owncloud/lib/private/Files/Storage/Wrapper/Encryption.php(172): OC\Files\Storage\Common->getMetaData('avatar.32.png')                                                                             
#7 /srv/secure/owncloud/lib/private/Files/Storage/Wrapper/Wrapper.php(572): OC\Files\Storage\Wrapper\Encryption->getMetaData('avatar.32.png')                                                                    
#8 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(113): OC\Files\Storage\Wrapper\Wrapper->getMetaData('avatar.32.png')                                                                                 
#9 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(145): OC\Files\Cache\Scanner->getData('avatar.32.png')                                                                                               
#10 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(409): OC\Files\Cache\Scanner->scanFile('avatar.32.png', 3, '10435', Object(OC\Files\Cache\CacheEntry), true)                                        
#11 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(377): OC\Files\Cache\Scanner->handleChildren('', true, 3, '10435', true, 0)                                                                         
#12 /srv/secure/owncloud/lib/private/Files/Cache/Scanner.php(311): OC\Files\Cache\Scanner->scanChildren('', true, 3, 10435, true)                                                                                
#13 /srv/secure/owncloud/lib/private/Files/Utils/Scanner.php(217): OC\Files\Cache\Scanner->scan('', true, 3)                                                                                                     
#14 /srv/secure/owncloud/apps/files/lib/Command/Scan.php(158): OC\Files\Utils\Scanner->scan('/Alex')                                                                                                             
#15 /srv/secure/owncloud/apps/files/lib/Command/Scan.php(226): OCA\Files\Command\Scan->scanFiles('Alex', '/Alex', true, Object(Symfony\Component\Console\Output\ConsoleOutput), false)                           
#16 /srv/secure/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))                                                                                                                                                                                                            
#17 /srv/secure/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))   
#18 /srv/secure/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))     
#19 /srv/secure/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))                                                                                                                                                            
#20 /srv/secure/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))                                                                                                                                                                                                   
#21 /srv/secure/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(NULL, NULL)                                                                                        
#22 /srv/secure/owncloud/console.php(102): OC\Console\Application->run()                                                                                                                                         
#23 /srv/secure/owncloud/occ(11): require_once('/srv/secure/own...')                                                                                                                                             
#24 {main}

Integrity status for oC9+

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.
Results
=======
- galleryplus
	- INVALID_HASH
		- appinfo/info.xml
Raw output
==========
Array
(
    [galleryplus] => Array
        (
            [INVALID_HASH] => Array
                (
                    [appinfo/info.xml] => Array
                        (
                            [expected] => 4d33d52394703fcc34c5a7d5d9d7b49eb5b1445267926679429f894dd7fae9fc47d5838a875aa59c675a15bbbd6578405383e1629df92661c57aa564d2818877
                            [current] => 3f0f2793fbefe031c75a3c5845f372a7863b0e3620b89f1a50506adfb5ea8caf4791c84162bb665eb00db5198185511ac2b209528b780407ca221376f29ff368
                        )
                )

    )
)

#2

Solved by me.
I have edited the file '...resources/config/mimetypemapping.dist.json' before.
But I forgot a coma at the line ending.
Sorry for this :wink: