wordpress-develop/tests/phpunit/tests/query
Boone Gorges 30c21d2031 Posts: Avoid the use of globals in get_the_content() and related functions.
This changeset introduces `$post` parameters to `get_the_content()` and
`wp_trim_excerpt()`. When a `$post` object is passed to one of these functions,
the functions will operate on the data from that object, rather than from the
post globals (`$authordata`, `$page`, etc). This ensures that the functions work
in a predictable manner when used outside of the regular post loop.

The global-mismatch problem is surfaced in cases where `get_the_excerpt()` is
called outside of the post loop, on posts that don't have a defined excerpt. In
these cases, the post globals - used to generate a fallback excerpt - may refer
to the incorrect object, resulting in PHP notices or other unpredictable
behavior. See #36934 for a related issue.

Props spacedmonkey, kraftbj, Shital Patel.
Fixes #42814.

git-svn-id: https://develop.svn.wordpress.org/trunk@44941 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-20 15:48:46 +00:00
..
commentCount.php Code is Poetry. 2017-11-30 23:09:33 +00:00
conditionals.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
date.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
dateQuery.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
generatePostdata.php Posts: Avoid the use of globals in get_the_content() and related functions. 2019-03-20 15:48:46 +00:00
isTerm.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
metaQuery.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
noFoundRows.php Code is Poetry. 2017-11-30 23:09:33 +00:00
parseQuery.php Code is Poetry. 2017-11-30 23:09:33 +00:00
postStatus.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
results.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
search.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
setupPostdata.php Code is Poetry. 2017-11-30 23:09:33 +00:00
stickies.php Code is Poetry. 2017-11-30 23:09:33 +00:00
taxQuery.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
vars.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
verboseRewriteRules.php Built/Test Tools: Unify the way the permastructure is set when used in conjunction with re-registering the initial taxonomies. This ensure that rewrite rules for taxonomies are consistently available. 2016-09-26 17:01:48 +00:00