Skip to content

[Bug]: Upgrade process re-renders config.php in a less readable/useable fashion #55171

@Keeper-of-the-Keys

Description

@Keeper-of-the-Keys

⚠️ This issue respects the following points: ⚠️

Bug description

It seems that processes like upgrades that "re-render" config.php make it less readable.

Config variable constants (like PDO::MYSQL_ATTR_SSL_CA becomes 1009) get rendered into their actual values which is both less human readable and can also break a configuration in the far-fetched case that they change the numbering of these attributes upstream.

In addition to the above comments are also removed which may not be ideal.

Steps to reproduce

  1. On a not fully up to date installation of nextcloud configure SSL for the database connection by adding the following as per the documentation
'dbdriveroptions' => [
//  \PDO::MYSQL_ATTR_SSL_KEY => '/../ssl-key.pem',
//  \PDO::MYSQL_ATTR_SSL_CERT => '/../ssl-cert.pem',
  \PDO::MYSQL_ATTR_SSL_CA => '/etc/ssl/certs/ca-certificates.crt',
  \PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => true,
],

(in my case I used LE so I only needed to set the CA and VERIFY_SERVER_CERT)
2. Run a nextcloud update
3. Look at the contents of config.php it is now and any comments that were in it are gone:

'dbdriveroptions' => 
  array (
    1009 => '/etc/ssl/certs/ca-certificates.crt',
    1014 => true,
  ),

Expected behavior

At least constant names (\PDO::....) should have been preserved and ideally comments should too.

Nextcloud Server version

31

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Apache (supported)

Database engine version

MariaDB

Additional info

Discovered with 31.0.7 -> 31.0.9.1 upgrade, verified by rolling the vm back and doing it again.

While I understand the process that most likely causes this (config.php is re-rendered from the state of nextcloud during the update, thus we only have the actual data structure), it seems to me that if this is something that can't be changed a comment header needs to be added that warns that documentation in the form of comments will not be preserved in upgrades or alternatively that only comments outside of the $CONFIG array can be preserved.

I do think that preserving constant names is critical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap31-feedbackbug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions