wordpress-develop/tests/phpunit/tests/formatting
Sergey Biryukov d93f76dca8 Code Modernization: Correct handling of null in wp_parse_str().
This fixes `parse_str(): Passing null to parameter #1 ($string) of type string is deprecated` notices on PHP 8.1, without change in behaviour.

Impact: 311 of the pre-existing tests are affected by this issue.

The PHP native `parse_str()` function expects a string, however, based on the failing tests, it is clear there are functions in WordPress which passes a non-string – including `null` – value to the `wp_parse_str()` function, which would subsequently pass it onto the PHP native function without further input validation.

Most notable offender is the `wp_parse_args()` function which special cases arrays and objects, but passes everything else off to `wp_parse_str()`.

Several ways to fix this issue have been explored, including checking the received value with `is_string()` or `is_scalar()` before passing it off to the PHP native `parse_str()` function.

In the end it was decided against these in favor of a string cast as:
* `is_string()` would significantly change the behavior for anything non-string.
* `is_scalar()` up to a point as well, as it does not take objects with a `__toString()` method into account.

Executing a string cast on the received value before passing it on maintains the pre-existing behavior while still preventing the deprecation notice coming from PHP 8.1.

Reference: [https://www.php.net/manual/en/function.parse-str.php PHP Manual: parse_str()]

Follow-up to [5709].

Props jrf, hellofromTonya, lucatume, SergeyBiryukov.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51624 602fd350-edb4-49c9-b593-d223f7449a82
2021-08-16 22:16:32 +00:00
..
balanceTags.php 5.7-alpha-50000 🎉🙌❤️ 2021-01-21 12:37:39 +00:00
capitalPDangit.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
cleanPre.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
convertInvalidEntries.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
convertSmilies.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
date.php Tests: Add a polyfill for assertEqualsWithDelta() to WP_UnitTestCase and use it where appropriate. 2020-09-07 03:12:17 +00:00
emoji.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
ent2ncr.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
escAttr.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
escHtml.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
escJs.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
escTextarea.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
escUrl.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
escXml.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
excerptRemoveBlocks.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
getBloginfo.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
getUrlInContent.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
humanTimeDiff.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
isEmail.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
likeEscape.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
linksAddTarget.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
makeClickable.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
mapDeep.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
normalizeWhitespace.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
redirect.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
removeAccents.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizeFileName.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizeMimeType.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizeOrderby.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizePost.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizeTextField.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizeTitle.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizeTitleWithDashes.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizeTrackbackUrls.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
sanitizeUser.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
seemsUtf8.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
slashit.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
stripslashesDeep.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
urlencodeDeep.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
urlShorten.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
utf8UriEncode.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpAutop.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpBasename.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpHtmleditPre.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpHtmlExcerpt.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpHtmlSplit.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpIsoDescrambler.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpMakeLinkRelative.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpParseStr.php Code Modernization: Correct handling of null in wp_parse_str(). 2021-08-16 22:16:32 +00:00
wpRelNofollow.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpRelUgc.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpReplaceInHtmlTags.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpRicheditPre.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpSlash.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpSpecialchars.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpStripAllTags.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpTargetedLinkRel.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpTexturize.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpTrimExcerpt.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
wpTrimWords.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00
zeroise.php Tests: Rename classes in phpunit/tests/formatting/ per the naming conventions. 2021-08-16 21:33:54 +00:00