Skip to content

php7.4 Error: Trying to access array offset on value of type null at /var/www/nextcloud/apps/logreader/lib/Log/LogIterator.php#78 #352

Closed

Description

@dvino

Steps to reproduce

Use NC 18.0-18.04, 19.0

Actual behaviour

log:
[PHP] Error: Trying to access array offset on value of type null at /var/www/nextcloud/apps/logreader/lib/Log/LogIterator.php#78

GET /apps/logreader/get?offset=0&count=50&levels=00111

Server configuration

Operating system:
Linux 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2 (2020-04-29) x86_64

Web server:
nginx/1.18.0 (fpm-fcgi)

Database:
pgsql PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit

PHP version:
7.4.6

Details Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, sodium, cgi-fcgi, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, imagick, imap, intl, json, ldap, exif, memcache, pdo_pgsql, pgsql, apc, posix, readline, redis, shmop, SimpleXML, smbclient, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlrpc, xmlwriter, xsl, zip, Phar, libsmbclient, Zend OPcache

Nextcloud version: (see Nextcloud admin page)
19.0.0 - 19.0.0.12

Where did you install Nextcloud from:
18 was clear install 19 was updated from 18

List of activated apps:

Details Enabled: - accessibility: 1.5.0 - activity: 2.12.0 - admin_audit: 1.9.0 - apporder: 0.10.0 - audioplayer: 2.10.0 - breezedark: 19.0.0 - bruteforcesettings: 1.6.0 - calendar: 2.0.3 - camerarawpreviews: 0.7.3 - carnet: 0.22.0 - cloud_federation_api: 1.2.0 - comments: 1.9.0 - contacts: 3.3.0 - contactsinteraction: 1.0.0 - dav: 1.15.0 - deck: 1.0.2 - documentserver_community: 0.1.5 - extract: 1.2.4 - federatedfilesharing: 1.9.0 - files: 1.14.0 - files_accesscontrol: 1.9.0 - files_downloadactivity: 1.8.0 - files_external: 1.10.0 - files_pdfviewer: 1.8.0 - files_rightclick: 0.16.0 - files_sharing: 1.11.0 - files_trashbin: 1.9.0 - files_versions: 1.12.0 - files_videoplayer: 1.8.0 - groupfolders: 6.0.6 - impersonate: 1.6.0 - issuetemplate: 0.6.0 - logreader: 2.4.0 - lookup_server_connector: 1.7.0 - mail: 1.3.5 - maps: 0.1.6 - metadata: 0.11.1 - nextcloud_announcements: 1.8.0 - notifications: 2.7.0 - oauth2: 1.7.0 - ocdownloader: 1.7.7 - onlyoffice: 4.1.4 - password_policy: 1.9.1 - photos: 1.1.0 - previewgenerator: 2.3.0 - privacy: 1.3.0 - provisioning_api: 1.9.0 - ransomware_protection: 1.7.0 - recommendations: 0.7.0 - settings: 1.1.0 - side_menu: 1.7.0 - spreed: 9.0.0 - tasks: 0.13.1 - text: 3.0.1 - theming: 1.10.0 - theming_customcss: 1.6.0 - twofactor_backupcodes: 1.8.0 - twofactor_gateway: 0.16.0 - twofactor_nextcloud_notification: 2.3.0 - twofactor_totp: 4.1.3 - updatenotification: 1.9.0 - viewer: 1.3.0 - workflowengine: 2.1.0 Disabled: - bookmarks - cospend - encryption - federation - files_lock - files_markdown - files_trackdownloads - firstrunwizard - forms - notes - occweb - ocr - radio - serverinfo - sharebymail - support - survey_client - systemtags - user_external - user_ldap - w2g2

Nextcloud configuration:

Details { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "***REMOVED SENSITIVE VALUE***" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "version": "19.0.0.12", "dbtype": "pgsql", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbname": "***REMOVED SENSITIVE VALUE***", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "installed": true, "default_language": "ru", "default_locale": "ru_RU", "force_locale": "ru_RU", "defaultapp": "apporder", "knowledgebaseenabled": true, "allow_user_to_change_display_name": true, "remember_login_cookie_lifetime": 7776000, "session_lifetime": 86400, "session_keepalive": true, "token_auth_enforced": false, "auth.bruteforce.protection.enabled": true, "skeletondirectory": "core\/skeleton", "lost_password_link": "disabled", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpdebug": false, "mail_smtpmode": "smtp", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": 465, "mail_smtptimeout": 10, "mail_smtpsecure": "ssl", "mail_smtpauth": true, "mail_smtpauthtype": "LOGIN", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "mail_template_class": "\\OC\\Mail\\EMailTemplate", "mail_send_plaintext_only": false, "mail_smtpstreamoptions": [], "mail_sendmailmode": "smtp", "trashbin_retention_obligation": "auto", "versions_retention_obligation": "auto", "appcodechecker": true, "updatechecker": true, "updater.server.url": "https:\/\/updates.nextcloud.com\/updater_server\/", "updater.release.channel": "stable", "has_internet_connection": true, "connectivity_check_domains": [ "www.nextcloud.com", "www.startpage.com", "www.eff.org", "www.edri.org" ], "check_for_working_wellknown_setup": true, "check_for_working_htaccess": true, "check_data_directory_permissions": true, "config_is_read_only": false, "log_type": "file", "logfile": "\/var\/log\/nextcloud\/nextcloud.log", "logfilemode": 416, "loglevel": 2, "syslog_tag": "Nextcloud", "logdateformat": "d.m.Y H:i:s", "logtimezone": "Europe\/Moscow", "log_query": false, "log_rotate_size": 104857600, "appstoreenabled": true, "apps_paths": [ { "path": "\/var\/www\/nextcloud\/apps", "url": "\/apps", "writable": true } ], "enable_previews": true, "preview_max_x": 2048, "preview_max_y": 2048, "preview_max_filesize_image": 10, "enabledPreviewProviders": [ "OC\\Preview\\PNG", "OC\\Preview\\JPEG", "OC\\Preview\\GIF", "OC\\Preview\\HEIC", "OC\\Preview\\BMP", "OC\\Preview\\XBitmap", "OC\\Preview\\MP3", "OC\\Preview\\TXT", "OC\\Preview\\MarkDown", "OC\\Preview\\Illustrator", "OC\\Preview\\SVG", "OC\\Preview\\TIFF" ], "sort_groups_by_name": false, "memcache.distributed": "\\OC\\Memcache\\Redis", "memcache.locking": "\\OC\\Memcache\\Redis", "memcache.local": "\\OC\\Memcache\\APCu", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 6379, "timeout": 0, "password": "***REMOVED SENSITIVE VALUE***", "dbindex": 0 }, "supportedDatabases": [ "pgsql" ], "tempdirectory": "\/tmp\/nextcloudtemp", "cipher": "AES-256-CFB", "login_form_autocomplete": true, "secret": "***REMOVED SENSITIVE VALUE***", "overwrite.cli.url": "https:\/\/vinokurov.tk", "dbport": "", "app_install_overwrite": [ "radio", "ocdownloader", "issuetemplate", "camerarawpreviews", "documentserver_community", "onlyoffice" ], "maintenance": false, "theme": "", "has_rebuilt_cache": true, "updater.secret": "***REMOVED SENSITIVE VALUE***" }

Client configuration

latest Chrome and firefox

Operating system:
Windows, Ubuntu

Logs

Nextcloud log (data/owncloud.log)

{"reqId":"rBepve1D9vtWSXtJktT8","level":3,"time":"2020-06-04T13:36:08+03:00","remoteAddr":"81.2.250.137","user":"danil","app":"PHP","method":"GET","url":"/apps/logreader/get?offset=0&count=50&levels=00111","message":"Trying to access array offset on value of type null at /var/www/nextcloud/apps/logreader/lib/Log/LogIterator.php#78","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36","version":"19.0.0.12","id":"5ed8ce9869083"}

Activity

  1. BugMaxe commented on Jun 4, 2020

    @BugMaxe

    Exactly same problem, upgrade NC to 19 and also PHP to 7.4.6

  2. gazn3vada commented on Jul 8, 2020

    @gazn3vada

    Same problem here

    • NC 19.0.0 (clean install)
    • apache 2.4.41
    • php 7.4.3
  3. TeslaBenny commented on Jul 22, 2020

    @TeslaBenny

    Same problem for me

    • Nextcloud 19.0.1
    • Ubuntu 18.04.4 LTS
    • Apache 2.4.29
    • PHP 7.4.8 (recently upgraded from PHP 7.2)
  4. tuxedo-rb commented on Aug 28, 2020

    @tuxedo-rb

    An solution approach:

    I copied a log line from my nextcloud.log file and made some tests in interactive PHP shell.
    My decoded log line returned always NULL and produced an JSON_ERROR_SYNTAX message.
    The reason are the double backslashes in some log entries.

    dev@dev-tux:~$ php -a
    Interactive mode enabled
    
    php > $logLine='{"reqId":"PItQPEON8tyXiPLICJbQ","level":1,"time":"2020-08-27T07:14:12+00:00","remoteAddr":"10.0.2.15","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?requesttoken=os7AxDkzf7DXkZFLXbECjrQ41qVzxzIbEVR3t3w5eBA%3D%3A8r24qml%2BVMe2qfAjb%2F1s%2Bptzn8ogq3doSGcN8hpQMFI%3D","message":"\\OC\\Repair::info: Repair info: No need to remove link shares.","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0","version":"19.0.2.0"}';
    php > $entry=json_decode($logLine,true);
    php > if(json_last_error()){var_dump($entry);echo json_last_error_msg().' ('.json_last_error().')' ;}else{var_dump($entry);}
    php shell code:1:
    NULL
    Syntax error (4)

    I had to escape the double backslashes to get a valid decode-able JSON string.

    php > $logLine='{"reqId":"PItQPEON8tyXiPLICJbQ","level":1,"time":"2020-08-27T07:14:12+00:00","remoteAddr":"10.0.2.15","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?requesttoken=os7AxDkzf7DXkZFLXbECjrQ41qVzxzIbEVR3t3w5eBA%3D%3A8r24qml%2BVMe2qfAjb%2F1s%2Bptzn8ogq3doSGcN8hpQMFI%3D","message":"\\OC\\Repair::info: Repair info: No need to remove link shares.","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0","version":"19.0.2.0"}';
    php > $logLine=str_replace('\\', '\\\\', $logLine);
    php > $entry=json_decode($logLine,true);
    php > if(json_last_error()){var_dump($entry);echo json_last_error_msg().' ('.json_last_error().')' ;}else{var_dump($entry);}
    php shell code:1:
    array(11) {
      'reqId' =>
      string(20) "PItQPEON8tyXiPLICJbQ"
      'level' =>
      int(1)
      'time' =>
      string(25) "2020-08-27T07:14:12+00:00"
      'remoteAddr' =>
      string(9) "10.0.2.15"
      'user' =>
      string(2) "--"
      'app' =>
      string(7) "updater"
      'method' =>
      string(3) "GET"
      'url' =>
      string(136) "/core/ajax/update.php?requesttoken=os7AxDkzf7DXkZFLXbECjrQ41qVzxzIbEVR3t3w5eBA%3D%3A8r24qml%2BVMe2qfAjb%2F1s%2Bptzn8ogq3doSGcN8hpQMFI%3D"
      'message' =>
      string(61) "\OC\Repair::info: Repair info: No need to remove link shares."
      'userAgent' =>
      string(76) "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0"
      'version' =>
      string(8) "19.0.2.0"
    }
  5. CarlSchwan commented on Jan 10, 2022

    @CarlSchwan
    Member

    Should be fixed with #631 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions