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

Detect leading spaces in config files #33447

Merged
merged 1 commit into from
Aug 4, 2022

Conversation

PVince81
Copy link
Member

@PVince81 PVince81 commented Aug 3, 2022

Because those will cause PHP to output to stdout and will cause
unrelated error messages.

Steps to reproduce:

  1. Create a config file "config/app.config.php" and add your apps_paths section (or anything else)
  2. In that config file, add spaces in front of <?php
  3. Open Nextcloud

Before: internal server error with mysterious errors in the log about ini settings that cannot be set at this stage

After: explicit error about the invalid file, both in occ and web UI

Background: I lost some time with this, believing that an app was broken. In my setup I have a bash script that generates the sidecar config files using cat << and I mistakenly indented the contents of the file

@PVince81 PVince81 added enhancement 3. to review Waiting for reviews labels Aug 3, 2022
@PVince81 PVince81 added this to the Nextcloud 25 milestone Aug 3, 2022
@PVince81 PVince81 self-assigned this Aug 3, 2022
@PVince81
Copy link
Member Author

PVince81 commented Aug 3, 2022

the tests fail, maybe the bootstrapping thing is generating files like I did... hope it's not a can of worms

@PVince81
Copy link
Member Author

PVince81 commented Aug 3, 2022

ok, I suspect that maybe something else during the tests is triggering an output and making header_sent() to return true

I'll add a condition to detect testing also

Because those will cause PHP to output to stdout and will cause
unrelated error messages.

Signed-off-by: Vincent Petry <[email protected]>
@PVince81 PVince81 force-pushed the bugfix/noid/detect-leading-spaces-in-config branch from fcffdb7 to 89cb450 Compare August 3, 2022 08:51
@PVince81 PVince81 added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 3, 2022
@nickvergessen
Copy link
Member

ok, I suspect that maybe something else during the tests is triggering an output and making header_sent() to return true

Could also only check that if header_sent() was false before loading the config files

@PVince81 PVince81 merged commit 5d697b5 into master Aug 4, 2022
@PVince81 PVince81 deleted the bugfix/noid/detect-leading-spaces-in-config branch August 4, 2022 08:55
@skjnldsv skjnldsv mentioned this pull request Aug 11, 2022
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 enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants