Skip to content

Conversation

@juliusknorr
Copy link
Member

This will make sure we get some more useful error log messages that contain a trace to the actual place in code that caused the issue when a PHP error is catched, e.g. for a "Trying to access array offset on value of type null" error.

Example output:

{
  "reqId": "SDrgQ5mzjHWyKLd9bP3u",
  "level": 0,
  "time": "2020-09-29T06:53:42+00:00",
  "remoteAddr": "192.168.21.9",
  "user": "admin",
  "app": "PHP",
  "method": "GET",
  "url": "/test.php",
  "message": {
    "Exception": "Error",
    "Message": "Trying to access array offset on value of type null at /var/www/html/test.php#15",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/test.php",
        "line": 15,
        "function": "onAll",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          8,
          "Trying to access array offset on value of type null",
          "/var/www/html/test.php",
          15,
          {
            "foo": null,
            "bar": null
          }
        ]
      },
      {
        "file": "/var/www/html/test.php",
        "line": 18,
        "function": "bar",
        "args": []
      },
      {
        "file": "/var/www/html/test.php",
        "line": 30,
        "function": "foo",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/private/Log/ErrorHandler.php",
    "Line": 98,
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0",
  "version": "21.0.0.0"
}

Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O nice!

@ChristophWurst ChristophWurst added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Sep 29, 2020
@ChristophWurst ChristophWurst added this to the Nextcloud 21 milestone Sep 29, 2020
@faily-bot
Copy link

faily-bot bot commented Sep 29, 2020

🤖 beep boop beep 🤖

Here are the logs for the failed build:

Status of 33447: failure

mysql8.0-php7.4

@rullzer rullzer merged commit 18411b8 into master Sep 29, 2020
@rullzer rullzer deleted the bugfix/extend-php-error-logging branch September 29, 2020 08:02
@rullzer
Copy link
Member

rullzer commented Sep 29, 2020

/backport to stable20

@rullzer
Copy link
Member

rullzer commented Sep 29, 2020

/backport to stable19

@rullzer
Copy link
Member

rullzer commented Sep 29, 2020

/backport to stable18

@backportbot-nextcloud
Copy link

The backport to stable18 failed. Please do this backport manually.

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

Labels

4. to release Ready to be released and/or waiting for tests to finish bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants