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

Generators/Markdown: reset error_reporting to original value #688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 15, 2024

Description

As things were, the Markdown class changes the PHP error level (to prevent potentially getting a warning about the timezone not being set), but doesn't reset the error level back to the original error level once the "risky" code has been executed.

Fixed now.

This was previously already fixed for the HTML class in PR squizlabs/PHP_CodeSniffer#488

Includes adding a test to safeguard this for both classes. These tests need to be run in isolation so as not to get interference from the fact that the code is run in a test environment. I.e. without the @runInSeparateProcess, the test wouldn't fail when it should.

Suggested changelog entry

  • Fixed: Markdown Generator could leave error_reporting in an incorrect state.

Related issues/external references

This PR is part of a series of PRs which will add a complete set of tests for the Generator feature.

Also see: #671.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

As things were, the `Markdown` class changes the PHP error level (to prevent potentially getting a warning about the timezone not being set), but doesn't reset the error level back to the original error level once the "risky" code has been executed.

Fixed now.

This was previously already fixed for the `HTML` class in PR squizlabs/PHP_CodeSniffer 488

Includes adding a test to safeguard this for both classes. These tests need to be run in isolation so as not get interference from the fact that the code is run in a test environment. I.e. without the `@runInSeparateProcess`, the test wouldn't fail when it should.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant