Error on occ call: An unhandled exception has been thrown

Hello

I have a problem with occ and I cannot solve it. I’ll get the error on every call of occ on command line.

I’m using the NC docker container on a Univention Server.


Nextcloud version: 19.0.4-0
Operating system and version: Univention 4.4.6
Apache or nginx version: 2.4.41
PHP version: 7.4.3

The issue you are facing:

root@nextc-63506217:/# sudo -u www-data /var/www/html/occ -V                         
An unhandled exception has been thrown:
TypeError: preg_match() expects parameter 2 to be string, bool given in /var/www/html/lib/private/AppFramework/Http/Request.php:608
Stack trace:
#0 /var/www/html/lib/private/AppFramework/Http/Request.php(608): preg_match()
#1 /var/www/html/lib/private/AppFramework/Http/Request.php(627): OC\AppFramework\Http\Request->matchesTrustedProxy()
#2 /var/www/html/lib/private/AppFramework/Http/Request.php(934): OC\AppFramework\Http\Request->isTrustedProxy()
#3 /var/www/html/lib/private/AppFramework/Http/Request.php(862): OC\AppFramework\Http\Request->fromTrustedProxy()
#4 /var/www/html/lib/base.php(760): OC\AppFramework\Http\Request->getInsecureServerHost()
#5 /var/www/html/lib/base.php(1094): OC::init()
#6 /var/www/html/console.php(49): require_once('/var/www/html/l...')
#7 /var/www/html/occ(11): require_once('/var/www/html/c...')
#8 {main}

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

PHP modules installed:

root@nextc-63506217:/# dpkg -l | grep php
ii  libapache2-mod-php            2:7.4+75                          all          server-side, HTML-embedded scripting language (Apache 2 module) (default)
ii  libapache2-mod-php7.4         7.4.3-4ubuntu2.4                  amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php                           2:7.4+75                          all          server-side, HTML-embedded scripting language (default)
ii  php-apcu                      5.1.18+4.0.11-1build1             amd64        APC User Cache for PHP
ii  php-apcu-bc                   1.0.5-2build1                     amd64        APCu Backwards Compatibility Module
ii  php-bcmath                    2:7.4+75                          all          Bcmath module for PHP [default]
ii  php-common                    2:75                              all          Common files for PHP packages
ii  php-curl                      2:7.4+75                          all          CURL module for PHP [default]
ii  php-dompdf                    0.6.2+dfsg-3                      all          HTML to PDF converter
ii  php-font-lib                  0.3.1+dfsg-3                      all          read, parse, export and make subsets of different fonts
ii  php-gd                        2:7.4+75                          all          GD module for PHP [default]
ii  php-gmp                       2:7.4+75                          all          GMP module for PHP [default]
ii  php-imagick                   3.4.4-4                           amd64        Provides a wrapper to the ImageMagick library
ii  php-intl                      2:7.4+75                          all          Internationalisation module for PHP [default]
ii  php-ldap                      2:7.4+75                          all          LDAP module for PHP [default]
ii  php-mbstring                  2:7.4+75                          all          MBSTRING module for PHP [default]
ii  php-oauth                     2.0.4+1.2.3-1build1               amd64        OAuth 1.0 consumer and provider extension
ii  php-pear                      1:1.10.9+submodules+notgz-1       all          PEAR Base System
ii  php-pgsql                     2:7.4+75                          all          PostgreSQL module for PHP [default]
ii  php-xml                       2:7.4+75                          all          DOM, SimpleXML, WDDX, XML, and XSL module for PHP [default]
ii  php-zip                       2:7.4+75                          all          Zip module for PHP [default]
ii  php7.4                        7.4.3-4ubuntu2.4                  all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.4-bcmath                 7.4.3-4ubuntu2.4                  amd64        Bcmath module for PHP
ii  php7.4-cli                    7.4.3-4ubuntu2.4                  amd64        command-line interpreter for the PHP scripting language
ii  php7.4-common                 7.4.3-4ubuntu2.4                  amd64        documentation, examples and common module for PHP
ii  php7.4-curl                   7.4.3-4ubuntu2.4                  amd64        CURL module for PHP
ii  php7.4-gd                     7.4.3-4ubuntu2.4                  amd64        GD module for PHP
ii  php7.4-gmp                    7.4.3-4ubuntu2.4                  amd64        GMP module for PHP
ii  php7.4-intl                   7.4.3-4ubuntu2.4                  amd64        Internationalisation module for PHP
ii  php7.4-json                   7.4.3-4ubuntu2.4                  amd64        JSON module for PHP
ii  php7.4-ldap                   7.4.3-4ubuntu2.4                  amd64        LDAP module for PHP
ii  php7.4-mbstring               7.4.3-4ubuntu2.4                  amd64        MBSTRING module for PHP
ii  php7.4-opcache                7.4.3-4ubuntu2.4                  amd64        Zend OpCache module for PHP
ii  php7.4-pgsql                  7.4.3-4ubuntu2.4                  amd64        PostgreSQL module for PHP
ii  php7.4-readline               7.4.3-4ubuntu2.4                  amd64        readline module for PHP
ii  php7.4-xml                    7.4.3-4ubuntu2.4                  amd64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php7.4-zip                    7.4.3-4ubuntu2.4                  amd64        Zip module for PHP

Does anyone know how I fix it?

Thanks. :slight_smile:

sudo -u www-data php /var/www/html/occ -V ?

No. It’s the same call and the same result.