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

Display the data of the message when a plugin activation fails #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Tofandel
Copy link

@Tofandel Tofandel commented Mar 3, 2019

The wordpress error message for a plugin activation is always the same:
return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);

So the error message is not really helpfull
As such displaying the output there will help debuging

Also fix compatibility with WP4.8- and WP 5.1+ because the required file do not exist

Tofandel added 2 commits March 3, 2019 15:34
The wordpress error message for a plugin activation is always the same:
return new WP_Error('unexpected_output', __('The plugin generated unexpected output.'), $output);

So the error message is not really helpfull
As such displaying the output there will help debuging
echo "- " . $result->get_error_message( $code ) . PHP_EOL;
$data = $result->get_error_data( $code );
if ( ! empty( $data ) && is_string( $data ) ) {
echo "Data: " . $data;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Tofandel ! Sorry for the delay in reviewing it.

This looks good, except maybe there needs to be a new line output after the data. What do you think?

Suggested change
echo "Data: " . $data;
echo "Data: " . $data . PHP_EOL;

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

Successfully merging this pull request may close these issues.

2 participants