General: Revert code changes from [57191].

The unit tests for `get_bookmark()` expect the function to modify the `$GLOBALS` array directly.

Follow-up to [57191].

See #60021.

git-svn-id: https://develop.svn.wordpress.org/trunk@57192 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-12-15 14:31:56 +00:00
parent bd88eafee1
commit 8e56669a49

View File

@ -22,11 +22,11 @@
* @return array|object|null Type returned depends on $output value.
*/
function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {
global $link, $wpdb;
global $wpdb;
if ( empty( $bookmark ) ) {
if ( isset( $link ) ) {
$_bookmark = &$link;
if ( isset( $GLOBALS['link'] ) ) {
$_bookmark = & $GLOBALS['link'];
} else {
$_bookmark = null;
}
@ -34,8 +34,8 @@ function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {
wp_cache_add( $bookmark->link_id, $bookmark, 'bookmark' );
$_bookmark = $bookmark;
} else {
if ( isset( $link ) && ( $link->link_id == $bookmark ) ) {
$_bookmark = &$link;
if ( isset( $GLOBALS['link'] ) && ( $GLOBALS['link']->link_id == $bookmark ) ) {
$_bookmark = & $GLOBALS['link'];
} else {
$_bookmark = wp_cache_get( $bookmark, 'bookmark' );
if ( ! $_bookmark ) {