Skip to content

Prevent PHP notice by validating and sanitizing GET parameter#232

Open
divyadhiman22 wants to merge 1 commit into
WordPress:trunkfrom
divyadhiman22:fix-php-validation
Open

Prevent PHP notice by validating and sanitizing GET parameter#232
divyadhiman22 wants to merge 1 commit into
WordPress:trunkfrom
divyadhiman22:fix-php-validation

Conversation

@divyadhiman22
Copy link
Copy Markdown

What does this PR do?

This PR adds validation and sanitization for a GET parameter to prevent
PHP notices and improve security.

Why is this change needed?

Accessing undefined indexes can cause PHP warnings and unexpected behavior.

How was this tested?

Tested locally using WordPress and verified editor switching works correctly.

Copy link
Copy Markdown
Member

@desrosj desrosj left a comment

Choose a reason for hiding this comment

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

Hi @divyadhiman22 and thanks for this PR!

This PR does not make any changes to how this GET parameter is handled. It simply moves the phpcs:ignore statement to a new line and adds an inline comment.

Also, it's not clear what the actual notice is you're seeing in PHP. Could you share that with steps to reproduce?

Without those steps, I don't think that there is actually anything to fix here, unless a true nonce check is added out of the abundance of caution.

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.

3 participants