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

PHP fatal error with Jetpack v11 #13

Open
austinginder opened this issue Jun 18, 2022 · 5 comments
Open

PHP fatal error with Jetpack v11 #13

austinginder opened this issue Jun 18, 2022 · 5 comments

Comments

@austinginder
Copy link

On certain sites running Jetpack v11 and Passwords Evolved v1.3.2 I'm seeing PHP fatal errors which crashes wp-admin and WP-CLI over the command line. This is also an open issue on Jetpack: Automattic/jetpack#23835. The odd thing about the error is that it's very temperamental. I just deployed Passwords Evolved to 500 sites and only 26 of them are showing PHP fatal errors in the error logs. Out of those some I can't sign into the wp-admin some I can. Also what's bizarre is that the PHP fatals seem to go away after completing a full Jetpack sync over the command line.

wp jetpack sync start --skip-plugins=passwords-evolved

Here is what the error log looks like.

PHP Fatal error:  Uncaught InvalidArgumentException: Container doesn't have a value stored for the "password.generator" key. in /www/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php:94
Stack trace:
#0 /www/public/wp-content/plugins/passwords-evolved/src/Plugin.php(79): PasswordsEvolved\DependencyInjection\Container->offsetGet()
#1 /www/public/wp-content/plugins/passwords-evolved/pluggable.php(59): PasswordsEvolved\Plugin->get_password_generator()
#2 /www/public/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-client.php(132): wp_generate_password()
#3 /www/public/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-client.php(37): Automattic\Jetpack\Connection\Client::build_signed_request()
#4 /www/public/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-client.php(453): A in /www/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php on line 94
Fatal error: Uncaught InvalidArgumentException: Container doesn't have a value stored for the "password.generator" key. in /www/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php:94
Stack trace:
#0 /www/public/wp-content/plugins/passwords-evolved/src/Plugin.php(79): PasswordsEvolved\DependencyInjection\Container->offsetGet()
#1 /www/public/wp-content/plugins/passwords-evolved/pluggable.php(59): PasswordsEvolved\Plugin->get_password_generator()
#2 /www/public/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-client.php(132): wp_generate_password()
#3 /www/public/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-client.php(37): Automattic\Jetpack\Connection\Client::build_signed_request()
#4 /www/public/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-connection/src/class-client.php(453): A in /www/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php on line 94
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
@carlalexander
Copy link
Owner

Ok I remember @knutsp opening an issue on the support forums for this. I've read your ticket and the jetpack ticket and I think the fix I just did should work.

@austinginder could you test the change I did before I tag a version for it?

@austinginder
Copy link
Author

@carlalexander Just tried it out. Seems to be giving a new PHP fatal error.

Fatal error: Uncaught Error: Call to undefined function PasswordsEvolved\Configuration\wp_get_current_user() in /www/public/wp-content/plugins/passwords-evolved/src/Configuration/WordPressConfiguration.php:29
Stack trace:
#0 /www/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php(165): PasswordsEvolved\Configuration\WordPressConfiguration->modify(Object(PasswordsEvolved\DependencyInjection\Container))
#1 /www/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php(58): PasswordsEvolved\DependencyInjection\Container->modify(Object(PasswordsEvolved\Configuration\WordPressConfiguration))
#2 /www/public/wp-content/plugins/passwords-evolved/src/Plugin.php(120): PasswordsEvolved\DependencyInjection\Container->configure(Array)
#3 /www/public/wp-content/plugins/passwords-evolved/passwords-evolved.php(40): PasswordsEvolved\Plugin->load()
#4 /www/public/wp-settings.php(428): include_once('/www/...')
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1317): require('/www/...')
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1235): WP_CLI\Runner->load_wordpress()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\bootstrap()
#10 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('phar:///usr/loc...')
#11 /usr/local/bin/wp(4): include('phar:///usr/loc...')
#12 {main}
  thrown in /www/public/wp-content/plugins/passwords-evolved/src/Configuration/WordPressConfiguration.php on line 29
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
``

carlalexander added a commit that referenced this issue Jun 24, 2022
@carlalexander
Copy link
Owner

Oups my bad @austinginder 😅

I amended the commit with a change.

@austinginder
Copy link
Author

Installing from the latest commit still looks unstable on my end. I'm trying this on a clean local WordPress site:

wp plugin install https://github.com/carlalexander/passwords-evolved/archive/refs/heads/main.zip --force --activate

Results in the following.

Downloading installation package from https://github.com/carlalexander/passwords-evolved/archive/refs/heads/main.zip...
Unpacking the package...
Installing the plugin...
Renamed Github-based project from 'passwords-evolved-main' to 'passwords-evolved'.
Removing the old version of the plugin...
Plugin updated successfully.
Activating 'passwords-evolved'...
Plugin 'passwords-evolved' activated.
Success: Installed 1 of 1 plugins.
wp option get home
PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_validate_auth_cookie' not found or invalid function name in /home/austin/Caddy/anchor.localhost/public/wp-includes/class-wp-hook.php on line 307
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'wp_validate_auth_cookie' not found or invalid function name in /home/austin/Caddy/anchor.localhost/public/wp-includes/class-wp-hook.php on line 307
PHP Fatal error:  Uncaught Error: Call to undefined function wp_set_current_user() in /home/austin/Caddy/anchor.localhost/public/wp-includes/user.php:3585
Stack trace:
#0 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwords-evolved/src/Configuration/WordPressConfiguration.php(30): _wp_get_current_user()
#1 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php(143): PasswordsEvolved\Configuration\WordPressConfiguration->PasswordsEvolved\Configuration\{closure}()
#2 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php(99): PasswordsEvolved\DependencyInjection\Container->PasswordsEvolved\DependencyInjection\{closure}()
#3 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwords-evolved/src/Configuration/EventManagementConfiguration.php(49): PasswordsEvolved\DependencyInjection\Container->offsetGet()
#4 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwo in /home/austin/Caddy/anchor.localhost/public/wp-includes/user.php on line 3585
Fatal error: Uncaught Error: Call to undefined function wp_set_current_user() in /home/austin/Caddy/anchor.localhost/public/wp-includes/user.php:3585
Stack trace:
#0 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwords-evolved/src/Configuration/WordPressConfiguration.php(30): _wp_get_current_user()
#1 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php(143): PasswordsEvolved\Configuration\WordPressConfiguration->PasswordsEvolved\Configuration\{closure}()
#2 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwords-evolved/src/DependencyInjection/Container.php(99): PasswordsEvolved\DependencyInjection\Container->PasswordsEvolved\DependencyInjection\{closure}()
#3 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwords-evolved/src/Configuration/EventManagementConfiguration.php(49): PasswordsEvolved\DependencyInjection\Container->offsetGet()
#4 /home/austin/Caddy/anchor.localhost/public/wp-content/plugins/passwo in /home/austin/Caddy/anchor.localhost/public/wp-includes/user.php on line 3585
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.

@carlalexander
Copy link
Owner

Ok, so I'm going to remove this change and reopen the ticket.

With Ymir, I'm loading the plugin this way, but it's too early for that here. That's because all the user functions are pluggable. I'd need to load the pluggable file pre-emptively.

This is what the Jetpack fix is doing. I could do the same thing. But I don't think that's a good idea here because this would happen all the time based on where I'm loading things. They're adding that at a specific location as a safety measure.

@carlalexander carlalexander reopened this Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants