After updating to Nextcloud11.0.2 unable to upload or create txt file

Nextcloud version : 11.0.2
Operating system and version: Fedora25
> Selinux: enforcing, targeted

The _/var/www/html/nextcloud_ as well as the _data_ dir is recursively owned by "apache:apache"
I have relabeled selinux context by issuing **_semanage fcontext -a -t httpd\_sys\_rw\_content\_t_** and 
**_restorecon_** on   _/var/www/html/nextcloud_ as well as the _data_ dir.

Apache version: 2.4.25-1

PHP version: 7.0.17-1

Is this the first time you’ve seen this error?: yes

Can you reliably replicate it?: yes

####Steps

  1. Change any file in any nextcloud client, resulting in write access error (ultimately the fie is being added to ignorelist).
  2. Login to the web interface (admin), create a .txt file returning Cannot create file.
  3. Upload a file from the web interface returning Forbidden.

####The issue I am facing:
Upgraded from nextcloud 9 to nextcloud 11 stable following the manual upgrade method. Everything went smoothly without any error. I performed few security hardening following https://docs.nextcloud.com/server/11/admin_manual/configuration_server/harden_server.html (see below), along with memory caching (installed php-pecl-apcu and added ‘memcache.local’ => ‘\OC\Memcache\APCu’, in config.php), mainly to remove the warning messages in the admin page. Also increased the upload filesize (in /etc/php.ini).

The output of your Nextcloud log (#tail -1 path/to/nextcloud.log after trying to create test.txt in the web interface**):

{“reqId”:“WOrkU40acYSx5BBDJ- @wAAAAY”,“remoteAddr”:“XX.XXX.XXX.XXX”,“app”:“webdav”,“message”:“Exception: {“Message”:“HTTP\/1.1 403 Forbidden”,“Exception”:“Sabre\\DAV\\Exception\\Forbidden”,“Code”:0,“Trace”:”#0 \/var\/www\/html\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(1072): OCA\\DAV\\Connector\\Sabre\\Directory->createFile(‘test.txt’, Resource id #366)\n#1 \/var\/www\/html\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php(525): Sabre\\DAV\\Server->createFile(‘test.txt’, Resource id #366, NULL)\n#2 [internal function]: Sabre\\DAV\\CorePlugin->httpPut(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#3 \/var\/www\/html\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n#4 \/var\/www\/html\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(479): Sabre\\Event\\EventEmitter->emit(‘method:PUT’, Array)\n#5 \/var\/www\/html\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(254): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n#6 \/var\/www\/html\/nextcloud\/apps\/dav\/appinfo\/v1\/webdav.php(60): Sabre\\DAV\\Server->exec()\n#7 \/var\/www\/html\/nextcloud\/remote.php(165): require_once(’\/var\/www\/html\/n…’)\n#8 {main}",“File”:"\/var\/www\/html\/nextcloud\/apps\/dav\/lib\/Connector\/Sabre\/Directory.php",“Line”:126,“User”:“XXX”}",“level”:0,“time”:“2017-04-09T21:48:03-04:00”,“method”:“PUT”,“url”:"/nextcloud/remote.php/webdav/test.txt",“user”:“XXX”,“version”:“11.0.2.7”}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php

$CONFIG = array (
‘instanceid’ => ‘ocq4al45r7lk’,
‘passwordsalt’ => ‘XXXXXX’,
‘secret’ => ‘XXXX’,
‘trusted_domains’ =>
array (
0 => ‘example.com’,
),
‘datadirectory’ => ‘/home/nextcloud_data’,
‘overwrite.cli.url’ => ‘https://localhost/nextcloud’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘11.0.2.7’,
‘dbname’ => ‘nextcloud_db’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘nextcloud’,
‘dbpassword’ => ‘XXXX’,
‘logtimezone’ => ‘America/New_York’,
‘installed’ => true,
‘maintenance’ => false,
‘loglevel’ => 0,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘mail_from_address’ => ‘apache’,
‘mail_smtpmode’ => ‘php’,
‘mail_domain’ => ‘example.com’,
‘updater.release.channel’ => ‘stable’,
);

The output of your Apache/nginx/system log in /var/log/httpd/error_log:

[Sun Apr 09 23:29:57.723707 2017] [mpm_prefork:notice] [pid 25681] AH00170: caught SIGWINCH, shutting down gracefully
[Sun Apr 09 23:30:00.459140 2017] [core:notice] [pid 881] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Sun Apr 09 23:30:00.464098 2017] [suexec:notice] [pid 881] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Sun Apr 09 23:30:00.586937 2017] [auth_digest:notice] [pid 881] AH01757: generating secret for digest authentication …
[Sun Apr 09 23:30:00.589343 2017] [lbmethod_heartbeat:notice] [pid 881] AH02282: No slotmem from mod_heartmonitor
[Sun Apr 09 23:30:01.507257 2017] [mpm_prefork:notice] [pid 881] AH00163: Apache/2.4.25 (Fedora) OpenSSL/1.0.2k-fips PHP/7.0.17 configured – resuming normal operations
[Sun Apr 09 23:30:01.507345 2017] [core:notice] [pid 881] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’

####Apache configurations
ServerRoot "/etc/httpd"
Listen :80
Include conf.modules.d/
.conf
User apache
Group apache
ServerAdmin root@localhost

AllowOverride none
Require all denied

DocumentRoot “/var/www/html”
<Directory “/var/www”>
AllowOverride None
Require all granted

<Directory “/var/www/html”>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted


DirectoryIndex index.html

<Files “.ht*”>
Require all denied

ErrorLog "logs/error_log"
LogLevel warn

LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i”” combined
LogFormat “%h %l %u %t “%r” %>s %b” common

LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i” %I %O” combinedio

CustomLog “logs/access_log” combined


ScriptAlias /cgi-bin/ “/var/www/cgi-bin/”

<Directory “/var/www/cgi-bin”>
AllowOverride None
Options None
Require all granted


TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

AddDefaultCharset UTF-8

MIMEMagicFile conf/magic

EnableSendfile on

IndexOptions FancyIndexing HTMLTable VersionSort
Alias /icons/ "/usr/share/httpd/icons/"
<Directory "/usr/share/httpd/icons">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride None
    Require all granted
</Directory>
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core.
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif
ReadmeName README.html
HeaderName HEADER.html
<Files ".user.ini">
    Require all denied
</Files>
AddType text/html .php
DirectoryIndex index.php
<IfModule  mod_php7.c>
    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>
    php_value session.save_handler "files"
    php_value session.save_path    "/var/lib/php/session"
    php_value soap.wsdl_cache_dir  "/var/lib/php/wsdlcache"
</IfModule>
<IfModule !mod_php5.c>
  <IfModule !mod_php7.c>
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>
  </IfModule>
</IfModule>
Listen 443 https
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
SSLSessionCache         shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout  300
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
<VirtualHost _default_:443>
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite PROFILE=SYSTEM
SSLProxyCipherSuite PROFILE=SYSTEM
SSLCertificateFile /etc/httpd/conf.d/example.com.signed.by.CA/example_ssl-bundle.crt
SSLCertificateKeyFile /etc/httpd/conf.d/example.com.signed.by.CA/example.com.key
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
    SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>                                  
<IfModule mod_userdir.c>
    UserDir disabled
</IfModule>
<Directory "/home/*/public_html">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>
<VirtualHost *:80>
    ServerName example.com
    Redirect 301 / https://example.com/
</VirtualHost>
<VirtualHost *:80>
    ServerName www.example.com
    Redirect 301 / https://example.com/
</VirtualHost>
<VirtualHost *:443>
  ServerName example.com
    <IfModule mod_headers.c>
      Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload"
    </IfModule>
 </VirtualHost>
<LocationMatch "^/+$">
    Options -Indexes
    ErrorDocument 403 /.noindex.html
</LocationMatch>
<Directory /usr/share/httpd/noindex>
    AllowOverride None
    Require all granted
</Directory>
Alias /.noindex.html /usr/share/httpd/noindex/index.html

####sudo -u apache php /var/www/html/nextcloud/occ files:scan --all

Scanning files for 4 users
Starting scan for user 1 out of 4 (1XXX)
Exception while scanning: array_merge(): Argument #2 is not an array
#0 [internal function]: OCA\Files\Command\Scan->exceptionErrorHandler(2, 'array_merge(): ...', '/var/www/html/n...', 146, Array)
#1 /var/www/html/nextcloud/lib/private/Files/Type/Detection.php(146): array_merge(Array, NULL)
#2 /var/www/html/nextcloud/lib/private/Files/Type/Detection.php(167): OC\Files\Type\Detection->loadMappings()
#3 /var/www/html/nextcloud/lib/private/Files/Storage/Common.php(235): OC\Files\Type\Detection->detectPath('files_versions/...')
#4 /var/www/html/nextcloud/lib/private/Files/Storage/Common.php(656): OC\Files\Storage\Common->getMimeType('files_versions/...')
#5 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php(173): OC\Files\Storage\Common->getMetaData('files_versions/...')
#6 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(577): OC\Files\Storage\Wrapper\Encryption->getMetaData('files_versions/...')
#7 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(114): OC\Files\Storage\Wrapper\Wrapper->getMetaData('files_versions/...')
#8 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(153): OC\Files\Cache\Scanner->getData('files_versions/...')
#9 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(420): OC\Files\Cache\Scanner->scanFile('files_versions/...', 3, '41542', Object(OC\Files\Cache\CacheEntry), true)
#10 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren('files_versions', true, 3, '41542', true, 0)
#11 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('files_versions', true, 3, '41542', true)
#12 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(322): OC\Files\Cache\Scanner->scanChildren('', true, 3, '41529', true)
#13 /var/www/html/nextcloud/lib/private/Files/Utils/Scanner.php(196): OC\Files\Cache\Scanner->scan('', true, 3)
#14 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/1XXX')
#15 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(227): OCA\Files\Command\Scan->scanFiles('1XXX', '/1XXX', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#16 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(256): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(818): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /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))
#21 /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))
#22 /var/www/html/nextcloud/console.php(90): OC\Console\Application->run()
#23 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')
#24 {main}
Starting scan for user 2 out of 4 (2XXX)
Exception while scanning: array_merge(): Argument #2 is not an array
#0 [internal function]: OCA\Files\Command\Scan->exceptionErrorHandler(2, 'array_merge(): ...', '/var/www/html/n...', 146, Array)
#1 /var/www/html/nextcloud/lib/private/Files/Type/Detection.php(146): array_merge(Array, NULL)
#2 /var/www/html/nextcloud/lib/private/Files/Type/Detection.php(167): OC\Files\Type\Detection->loadMappings()
#3 /var/www/html/nextcloud/lib/private/Files/Storage/Common.php(235): OC\Files\Type\Detection->detectPath('files_versions/...')
#4 /var/www/html/nextcloud/lib/private/Files/Storage/Common.php(656): OC\Files\Storage\Common->getMimeType('files_versions/...')
#5 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php(173): OC\Files\Storage\Common->getMetaData('files_versions/...')
#6 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(577): OC\Files\Storage\Wrapper\Encryption->getMetaData('files_versions/...')
#7 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(114): OC\Files\Storage\Wrapper\Wrapper->getMetaData('files_versions/...')
#8 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(153): OC\Files\Cache\Scanner->getData('files_versions/...')
#9 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(420): OC\Files\Cache\Scanner->scanFile('files_versions/...', 3, '19', Object(OC\Files\Cache\CacheEntry), true)
#10 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren('files_versions', true, 3, '19', true, 0)
#11 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('files_versions', true, 3, '19', true)
#12 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(322): OC\Files\Cache\Scanner->scanChildren('', true, 3, '1', true)
#13 /var/www/html/nextcloud/lib/private/Files/Utils/Scanner.php(196): OC\Files\Cache\Scanner->scan('', true, 3)
#14 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/2XXX')
#15 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(227): OCA\Files\Command\Scan->scanFiles('2XXX', '/2XXX', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#16 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(256): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(818): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /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))
#21 /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))
#22 /var/www/html/nextcloud/console.php(90): OC\Console\Application->run()
#23 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')
#24 {main}
Starting scan for user 3 out of 4 (3XXX)
Exception while scanning: array_merge(): Argument #2 is not an array
#0 [internal function]: OCA\Files\Command\Scan->exceptionErrorHandler(2, 'array_merge(): ...', '/var/www/html/n...', 146, Array)
#1 /var/www/html/nextcloud/lib/private/Files/Type/Detection.php(146): array_merge(Array, NULL)
#2 /var/www/html/nextcloud/lib/private/Files/Type/Detection.php(167): OC\Files\Type\Detection->loadMappings()
#3 /var/www/html/nextcloud/lib/private/Files/Storage/Common.php(235): OC\Files\Type\Detection->detectPath('thumbnails/2750...')
#4 /var/www/html/nextcloud/lib/private/Files/Storage/Common.php(656): OC\Files\Storage\Common->getMimeType('thumbnails/2750...')
#5 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php(173): OC\Files\Storage\Common->getMetaData('thumbnails/2750...')
#6 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(577): OC\Files\Storage\Wrapper\Encryption->getMetaData('thumbnails/2750...')
#7 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(114): OC\Files\Storage\Wrapper\Wrapper->getMetaData('thumbnails/2750...')
#8 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(153): OC\Files\Cache\Scanner->getData('thumbnails/2750...')
#9 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(420): OC\Files\Cache\Scanner->scanFile('thumbnails/2750...', 3, '8052', Object(OC\Files\Cache\CacheEntry), true)
#10 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren('thumbnails/2750', true, 3, '8052', true, 0)
#11 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('thumbnails/2750', true, 3, '8052', true)
#12 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('thumbnails', true, 3, '8045', true)
#13 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(322): OC\Files\Cache\Scanner->scanChildren('', true, 3, '8029', true)
#14 /var/www/html/nextcloud/lib/private/Files/Utils/Scanner.php(196): OC\Files\Cache\Scanner->scan('', true, 3)
#15 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/3XXX')
#16 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(227): OCA\Files\Command\Scan->scanFiles('3XXX', '/3XXX', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#17 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(256): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(818): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /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))
#22 /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))
#23 /var/www/html/nextcloud/console.php(90): OC\Console\Application->run()
#24 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')
#25 {main}
Starting scan for user 4 out of 4 (4XXX)
Exception while scanning: array_merge(): Argument #2 is not an array
#0 [internal function]: OCA\Files\Command\Scan->exceptionErrorHandler(2, 'array_merge(): ...', '/var/www/html/n...', 146, Array)
#1 /var/www/html/nextcloud/lib/private/Files/Type/Detection.php(146): array_merge(Array, NULL)
#2 /var/www/html/nextcloud/lib/private/Files/Type/Detection.php(167): OC\Files\Type\Detection->loadMappings()
#3 /var/www/html/nextcloud/lib/private/Files/Storage/Common.php(235): OC\Files\Type\Detection->detectPath('files_versions/...')
#4 /var/www/html/nextcloud/lib/private/Files/Storage/Common.php(656): OC\Files\Storage\Common->getMimeType('files_versions/...')
#5 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php(173): OC\Files\Storage\Common->getMetaData('files_versions/...')
#6 /var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(577): OC\Files\Storage\Wrapper\Encryption->getMetaData('files_versions/...')
#7 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(114): OC\Files\Storage\Wrapper\Wrapper->getMetaData('files_versions/...')
#8 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(153): OC\Files\Cache\Scanner->getData('files_versions/...')
#9 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(420): OC\Files\Cache\Scanner->scanFile('files_versions/...', 3, '7882', Object(OC\Files\Cache\CacheEntry), true)
#10 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren('files_versions', true, 3, '7882', true, 0)
#11 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren('files_versions', true, 3, '7882', true)
#12 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(322): OC\Files\Cache\Scanner->scanChildren('', true, 3, '3379', true)
#13 /var/www/html/nextcloud/lib/private/Files/Utils/Scanner.php(196): OC\Files\Cache\Scanner->scan('', true, 3)
#14 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/4XXX')
#15 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(227): OCA\Files\Command\Scan->scanFiles('4XXX', '/4XXX', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#16 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(256): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/nextcloud/core/Command/Base.php(161): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(818): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /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))
#21 /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))
#22 /var/www/html/nextcloud/console.php(90): OC\Console\Application->run()
#23 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')
#24 {main}

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 9       | 0     | 00:00:02     |
+---------+-------+--------------+

####Update:
After reverting one change at a time, the issue was solved when selinux was disabled.

####Further thought
Did anyone using _selinux_in targeted mode faced similar issue? Is it possible to enforce selinux without getting locked out? The instruction for relabeling with semanage and restorecon is clearly not working, at least in fedora25. Therefore should it be considered a selinux bug or there are some other tweaking required apart from the semanage and restorecon instructions?