Skip to content

PHP warnings in SettingsService.php when saving Notes settings (_route treated as setting) #2054

Open

Description

@76c72cfe

When Notes settings are saved, Notes 6.1.0 generates PHP warnings in
lib/Service/SettingsService.php line 165.

The request contains _route, which appears to be handled as if it were a
Notes setting. SettingsService.php accesses $this->attrs[$name]['default']
on line 165 before checking array_key_exists($name, $this->attrs) on the
following line.

Each affected PUT request to /index.php/apps/notes/settings generated
multiple PHP warnings.

Steps to reproduce

  1. Open the Notes app.
  2. Change/save a Notes setting.
  3. Check nextcloud.log.

Expected behaviour

Notes settings should be saved without PHP warnings. Request parameters such
as _route should not be treated as Notes settings.

Actual behaviour

Saving Notes settings generates warnings such as:

Undefined array key "_route" at
/apps/notes/lib/Service/SettingsService.php#165

Trying to access array offset on null at
/apps/notes/lib/Service/SettingsService.php#165

The warnings were associated with:

PUT /index.php/apps/notes/settings

Screenshots

Not applicable.

Server

  • Notes app version: 6.1.0
  • Nextcloud version: 35.0.1
  • OS: CloudLinux (shared hosting)
  • Web server: LiteSpeed
  • PHP version: 8.4.25
  • Database: MariaDB 11.4.13

Nextcloud configuration:

No custom changes have been made to the Notes app.

Client

  • Browser (incl. version): Chromium-based browser
  • OS: Windows

Log files

Relevant nextcloud.log warnings:

Undefined array key "_route" at
/home/malamute/public_html/files/apps/notes/lib/Service/SettingsService.php#165

Trying to access array offset on null at
/home/malamute/public_html/files/apps/notes/lib/Service/SettingsService.php#165

Both observed request IDs used:

method: PUT
url: /index.php/apps/notes/settings

Activity

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

    bugSomething isn't workingneed to reproduceIssue that has not been reproduced

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions