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

wordcamp-participation-notifier.php fails to require wporg-mu-plugins/pub/profile-helpers.php #776

Closed
CdrMarks opened this issue May 29, 2022 · 5 comments
Assignees
Labels
[Component] Participation Notifier [Type] Bug [Type] Good First Issue Straightforward, self-contained, doesn't require deep knowledge of codebase

Comments

@CdrMarks
Copy link
Collaborator

Describe the bug

On a new install of the wordcamp.org evironment via Docker, this error is encountered.

Warning: require_once(/usr/src/public_html/wp-content/mu-plugins-private/wporg-mu-plugins/pub/profile-helpers.php): failed to open stream: No such file or directory in /usr/src/public_html/wp-content/plugins/wordcamp-participation-notifier/wordcamp-participation-notifier.php on line 29 Fatal error: require_once(): Failed opening required '/usr/src/public_html/wp-content/mu-plugins-private/wporg-mu-plugins/pub/profile-helpers.php' (include_path='.:/usr/local/lib/php') in /usr/src/public_html/wp-content/plugins/wordcamp-participation-notifier/wordcamp-participation-notifier.php on line 29 Notice: Function is_embed was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /usr/src/public_html/mu/wp-includes/functions.php on line 5831 Notice: Function is_search was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /usr/src/public_html/mu/wp-includes/functions.php on line 5831 Notice: Function is_offline was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /usr/src/public_html/mu/wp-includes/functions.php on line 5831 Notice: Function is_500 was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /usr/src/public_html/mu/wp-includes/functions.php on line 5831
There has been a critical error on this website.

This line was lasted edited 19 days ago via 89b2afc

To reproduce

Steps to reproduce the behavior:

  1. From a clean install, follow the instructions for https://github.com/WordPress/wordcamp.org/blob/production/.docker/readme.md
  2. Complete the docker compose up command in step 7
  3. Browse to https://central.wordcamp.test/
  4. See error (above)

Expected behavior

See
image

Workaround
Comment line 29 of wordcamp-participation-notifier.php

WordCamp

local wordcamp.test

System (please complete the following information):

  • Device: Laptop
  • OS: MBP
  • Browser: Chrome
  • Version: 102.0.5005.61 (Official Build) (x86_64)
@CdrMarks CdrMarks assigned CdrMarks and iandunn and unassigned CdrMarks May 29, 2022
@iandunn
Copy link
Member

iandunn commented May 30, 2022

Related #769

@iandunn
Copy link
Member

iandunn commented May 30, 2022

🤔 , does this line not return early for you?

/*
* Requests will always fail when in local environments, unless the dev is proxied. Proxied devs could test
* locally if they're careful (especially with user IDs), but it's better to test on w.org sandboxes with
* test accounts. That prevents real profiles from having test data accidentally added to them.
*/
if ( 'local' === wp_get_environment_type() ) {
return;
}

@CdrMarks
Copy link
Collaborator Author

CdrMarks commented May 31, 2022

@iandunn, I modified those line to the following as a test:

if ( 'local' === wp_get_environment_type() ) {
	return;
} else {
	wp_die( "WP Env:" . wp_get_environment_type() );
}

Here is the the output I'm seeing:

Notice: Function is_embed was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /usr/src/public_html/mu/wp-includes/functions.php on line 5831 Notice: Function is_search was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /usr/src/public_html/mu/wp-includes/functions.php on line 5831 Notice: Function is_offline was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /usr/src/public_html/mu/wp-includes/functions.php on line 5831 Notice: Function is_500 was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /usr/src/public_html/mu/wp-includes/functions.php on line 5831

WP Env:production

My local is running on wordpress.test.

@iandunn
Copy link
Member

iandunn commented May 31, 2022

Ah, that's right. We've got WORDCAMP_ENVIRONMENT === 'local' that predates environment types in Core, and we haven't migrated yet. There's some inconsistencies between how we you dev/prod and how Core does, IIRC.

The best fix for this case is probably something like

-if ( 'local' === wp_get_environment_type() ) {
+if ( 'local' === WORDCAMP_ENVIRONMENT ) {
	return;
}
@CdrMarks
Copy link
Collaborator Author

@iandunn, the suggested code change above resolved the error I was seeing. Does it makes sense to update the repository with an update to try to correct this for the next person who tries to setup a local environment with Docker?

@iandunn iandunn added [Type] Good First Issue Straightforward, self-contained, doesn't require deep knowledge of codebase [Component] Participation Notifier [Type] Bug [Priority] 1 labels Jun 3, 2022
@iandunn iandunn closed this as completed in 14e7aec Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Participation Notifier [Type] Bug [Type] Good First Issue Straightforward, self-contained, doesn't require deep knowledge of codebase
2 participants