Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Documentation contains non-available OC::$SERVERROOT #40460

Closed
4 of 8 tasks
danielmarschall opened this issue Sep 16, 2023 · 4 comments
Closed
4 of 8 tasks

[Bug]: Documentation contains non-available OC::$SERVERROOT #40460

danielmarschall opened this issue Sep 16, 2023 · 4 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug needs info

Comments

@danielmarschall
Copy link

⚠️ This issue respects the following points: ⚠️

Bug description

In the documentation https://docs.nextcloud.com/server/latest/admin_manual/apps_management.html at section "apps_path" (and maybe at several other documentation locations?) there is the following code snippet:

"apps_paths" => [
    [
            "path"     => OC::$SERVERROOT . "/apps",
            "url"      => "/apps",
            "writable" => false,
    ],
    [
            "path"     => OC::$SERVERROOT . "/apps2",
            "url"      => "/apps2",
            "writable" => true,
    ],
],

This does not work, because neither OC::$SERVERROOT nor \OC::$SERVERROOT can be used in config.php , probably because the auto-loader has not yet found class "OC".

So either the documentation should be fixed, or OC should be made available in config.php (which would be nice, since you don't need to remember canonical path names).

Steps to reproduce

  1. Include code snippet in config/config.php

Expected behavior

It should work without error

Installation method

None

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Enabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

@danielmarschall danielmarschall added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Sep 16, 2023
@joshtrichards
Copy link
Member

joshtrichards commented Sep 17, 2023

Hi @danielmarschall - Thanks for your report. I can't reproduce this problem. What's the actual error message you're seeing?

And what version of NC27 specifically are you using?

This config snippet is widely deployed - e.g.

Nearly all of my instances use it without any problem.

@danielmarschall
Copy link
Author

Hello @joshtrichards
Thanks for your fast reply.

The NextCloud version is 27.0.2 .
No apps except the default encryption module are installed.

The exact message is:
PHP Fatal error: Uncaught Error: Class "OC" not found in .../config/config.php

The system, in case it is important:
Linux 6.1.0-11-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-4 (2023-08-08) x86_64 GNU/Linux
PHP 8.2.7 (cli) (built: Jun 9 2023 19:37:27) (NTS)
PHP is accessed through php-fcgi

I can't explain that issue, because the class should be there, so I thought the auto-loader might not have been initialized when config.php is accessed?

@joshtrichards
Copy link
Member

Does occ config:list system generate the same error?

@solracsf solracsf changed the title [Bug]: Documentation contains non-available OC::$SERVERROOT [Bug]: Documentation contains non-available OC::$SERVERROOT Sep 18, 2023
@danielmarschall
Copy link
Author

Hello. I tested it again with nextcloud version 27.1.0. OC::$SERVERROOT now works in config/config.php and it is also correctly resolved in config:list . Sorry for the disturbance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug needs info
Projects
None yet
Development

No branches or pull requests

3 participants