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

Plausible throws fatal error on the WordPress playground #174

Closed
jdevalk opened this issue Feb 6, 2024 · 3 comments
Closed

Plausible throws fatal error on the WordPress playground #174

jdevalk opened this issue Feb 6, 2024 · 3 comments
Assignees

Comments

@jdevalk
Copy link
Contributor

jdevalk commented Feb 6, 2024

If you try to use the Plausible WordPress plugin on the WordPress playground, you get the following fatal error:

Fatal error: Uncaught RuntimeException: Plausible\Analytics\WP\Client\Lib\GuzzleHttp requires cURL, the allow_url_fopen ini setting, or a custom HTTP handler. in /wordpress/wp-content/plugins/plausible-analytics/src/Client/lib/Lib/GuzzleHttp/Utils.php:105 Stack trace:
#0 /wordpress/wp-content/plugins/plausible-analytics/src/Client/lib/Lib/GuzzleHttp/HandlerStack.php(49): Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Utils::chooseHandler()
#1 /wordpress/wp-content/plugins/plausible-analytics/src/Client/lib/Lib/GuzzleHttp/Client.php(53): Plausible\Analytics\WP\Client\Lib\GuzzleHttp\HandlerStack::create()
#2 /wordpress/wp-content/plugins/plausible-analytics/src/Client.php(36): Plausible\Analytics\WP\Client\Lib\GuzzleHttp\Client->__construct()
#3 /wordpress/wp-content/plugins/plausible-analytics/src/Admin/Provisioning.php(40): Plausible\Analytics\WP\Client->__construct()
#4 /wordpress/wp-content/plugins/plausible-analytics/src/Plugin.php(42): Plausible\Analytics\WP\Admin\Provisioning->__construct()
#5 /wordpress/wp-includes/class-wp-hook.php(3): Plausible\Analytics\WP\Plugin->register_services('')
#6 /wordpress/wp-includes/class-wp-hook.php(3): WP_Hook->apply_filters(NULL, Array)
#7 /wordpress/wp-includes/plugin.php(2): WP_Hook->do_action(Array)
#8 /wordpress/wp-settings.php(2): do_action('plugins_loaded')
#9 /wordpress/wp-config.php(99): require_once('/wordpress/wp-s...')
#10 /wordpress/wp-load.php(2): require_once('/wordpress/wp-c...')
#11 /wordpress/wp-admin/admin.php(2): require_once('/wordpress/wp-l...')
#12 /wordpress/wp-admin/index.php(2): require_once('/wordpress/wp-a...')
#13 {main} thrown in /wordpress/wp-content/plugins/plausible-analytics/src/Client/lib/Lib/GuzzleHttp/Utils.php on line 105

I was going to suggest "just" from using GuzzleHttp to WordPress core's Wp_Http library, using wp_remote_get or wp_remote_post, but looking at your code that might be non-trivial, which means you'll have to at least catch the RuntimeException above and throw a notice to the user instead of a fatal error.

@Dan0sz
Copy link
Collaborator

Dan0sz commented Feb 7, 2024

This issue is fixed in 2.0.3. Thanks again, @jdevalk!

@Dan0sz Dan0sz closed this as completed Feb 7, 2024
@jdevalk
Copy link
Contributor Author

jdevalk commented Feb 7, 2024

I still see it when I download the plugin from .org and install it in a clean playground?

@Dan0sz
Copy link
Collaborator

Dan0sz commented Feb 7, 2024

Pfff, I read past the allow_url_fopen part and was only checking for cURL. 🤦🏻‍♂️ Fix will be included in the next release! Thanks again!

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