Skip to content

Tests: cover the sticky/password interaction in edit_post() - #1

Closed
wppoland wants to merge 1 commit into
Hug0-Drelon:fix-64810from
wppoland:tests-64810
Closed

wppoland wants to merge 1 commit into
Hug0-Drelon:fix-64810from
wppoland:tests-64810

Conversation

@wppoland

Copy link
Copy Markdown

Offering this as a commit into your branch rather than a competing patch, since @wildworks flagged #64810 as needs-unit-tests in comment:6 and your PR is fix-only. Merge it here and it rides along with WordPress#11180 as one changeset — nothing else on your side changes.

The test reproduces what Quick Edit actually posts: sticky but no visibility. On trunk edit_post() never reaches case 'password', so unset( $post_data['sticky'] ) never runs and the post stays sticky with a password set. With your fix the inferred visibility reaches that branch and the post is unstuck.

tests/phpunit/tests/admin/includesPost.php had no coverage of the visibility / sticky / password interaction at all.

Verified locally:

  • trunk: fails, A password protected post was left sticky when no explicit visibility was sent.
  • this branch (your fix + this test): OK (1 test, 3 assertions)
  • whole file on this branch: 52 tests, 118 assertions, 0 failures. The 6 warnings are pre-existing PHPUnit 10 deprecation notices in the test_post_exists_* tests, unrelated to either change.

The fix is yours; I only wrote the test. If you'd rather squash it into your own commit, that's fine by me.

Adds a regression test for the fix in this branch: giving a sticky post a
password through edit_post() must unstick it even when the caller sends no
explicit `visibility`, which is what Quick Edit does.

Fails on trunk ("A password protected post was left sticky when no explicit
visibility was sent."), passes with the fix in this branch.
tests/phpunit/tests/admin/includesPost.php had no coverage of the
visibility/sticky/password interaction at all.

See #64810.
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props motylanogha.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@wppoland

Copy link
Copy Markdown
Author

Closing this and moving it to the upstream repo, where it is actually visible: WordPress#11180 (comment).

Same patch, unchanged. A PR into a fork branch only reaches you, and this test is what @wildworks asked for on #64810 before it can move, so it needs to sit where a committer will find it.

Take it into fix-64810 whenever suits. It only passes with your fix, so it belongs in your changeset rather than a separate one.

@wppoland wppoland closed this Aug 20, 2026
Hug0-Drelon pushed a commit that referenced this pull request Nov 19, 2026
…t is not set.

This resolves an error if `mysqli_num_fields()` is called before a successful SELECT-type query is performed:
{{{
mysqli_num_fields(): Argument #1 ($result) must be of type mysqli_result, false given
}}}

Developed in WordPress#13099.

Follow-up to r21472.

Props joehorntw, akshat2802, mukesh27, rejaulalomkhan, SergeyBiryukov.
Fixes #64130.

git-svn-id: https://develop.svn.wordpress.org/trunk@64458 602fd350-edb4-49c9-b593-d223f7449a82
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.

1 participant