Make WordPress Core


Ignore:
Timestamp:
09/30/2025 05:05:21 PM (11 months ago)
Author:
desrosj
Message:

Grouped backports for the 5.2 branch.

  • REST API: Increase the specificity of capability checks for collections when the edit context is in use.
  • Menus: Prevent HTML in menu item titles from being rendered unexpectedly.

Merges [60814], [60815], [60816] to the 5.2 branch.

Props andraganescu, desrosj, ehti, hurayraiit, iandunn, joehoyle, johnbillion, jorbin, mnelson4, noisysocks, peterwilsoncc, phillsav, rmccue, timothyblynjacobs, vortfu, westonruter , whyisjake, zieladam.

Location:
branches/5.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2

  • branches/5.2/tests/phpunit/tests/customize/nav-menus.php

    r43571 r60834  
    145145                // Home is included in menu items when page is zero.
    146146                $items = $menus->load_available_items_query( 'post_type', 'page', 0 );
    147                 $this->assertContains( $expected, $items );
     147                $this->assertContains( $expected, $items, "Items:\n" . var_export( $items, true ) );
    148148
    149149                // Home is not included in menu items when page is larger than zero.
    150150                $items = $menus->load_available_items_query( 'post_type', 'page', 1 );
    151151                $this->assertNotEmpty( $items );
    152                 $this->assertNotContains( $expected, $items );
     152                $this->assertNotContains( $expected, $items, "Items:\n" . var_export( $items, true ) );
    153153        }
    154154
     
    162162
    163163                // Create page.
    164                 $post_id = self::factory()->post->create( array( 'post_title' => 'Post Title' ) );
     164                $post_id = self::factory()->post->create( array( 'post_title' => 'Post <strong>Strong</strong> Title' ) );
    165165
    166166                // Create pages.
     
    169169                // Expected menu item array.
    170170                $expected = array(
    171                         'id'         => "post-{$post_id}",
    172                         'title'      => 'Post Title',
    173                         'type'       => 'post_type',
    174                         'type_label' => 'Post',
    175                         'object'     => 'post',
    176                         'object_id'  => intval( $post_id ),
    177                         'url'        => get_permalink( intval( $post_id ) ),
     171                        'id'             => "post-{$post_id}",
     172                        'title'          => 'Post <strong>Strong</strong> Title',
     173                        'original_title' => 'Post <strong>Strong</strong> Title',
     174                        'type'           => 'post_type',
     175                        'type_label'     => 'Post',
     176                        'object'         => 'post',
     177                        'object_id'      => (int) $post_id,
     178                        'url'            => get_permalink( (int) $post_id ),
    178179                );
    179180
    180181                // Offset the query and get the second page of menu items.
    181182                $items = $menus->load_available_items_query( 'post_type', 'post', 1 );
    182                 $this->assertContains( $expected, $items );
     183                $this->assertContains( $expected, $items, "Items:\n" . var_export( $items, true ) );
    183184        }
    184185
     
    201202                // Expected menu item array.
    202203                $expected = array(
    203                         'id'         => "post-{$page_id}",
    204                         'title'      => 'Page Title',
    205                         'type'       => 'post_type',
    206                         'type_label' => 'Page',
    207                         'object'     => 'page',
    208                         'object_id'  => intval( $page_id ),
    209                         'url'        => get_permalink( intval( $page_id ) ),
     204                        'id'             => "post-{$page_id}",
     205                        'title'          => 'Page Title',
     206                        'original_title' => 'Page Title',
     207                        'type'           => 'post_type',
     208                        'type_label'     => 'Page',
     209                        'object'         => 'page',
     210                        'object_id'      => (int) $page_id,
     211                        'url'            => get_permalink( (int) $page_id ),
    210212                );
    211213
    212214                $items = $menus->load_available_items_query( 'post_type', 'page', 0 );
    213                 $this->assertContains( $expected, $items );
     215                $this->assertContains( $expected, $items, "Items:\n" . var_export( $items, true ) );
    214216        }
    215217
     
    227229                // Expected menu item array.
    228230                $expected = array(
    229                         'id'         => "post-{$post_id}",
    230                         'title'      => 'Post Title',
    231                         'type'       => 'post_type',
    232                         'type_label' => 'Post',
    233                         'object'     => 'post',
    234                         'object_id'  => intval( $post_id ),
    235                         'url'        => get_permalink( intval( $post_id ) ),
     231                        'id'             => "post-{$post_id}",
     232                        'title'          => 'Post Title',
     233                        'original_title' => 'Post Title',
     234                        'type'           => 'post_type',
     235                        'type_label'     => 'Post',
     236                        'object'         => 'post',
     237                        'object_id'      => (int) $post_id,
     238                        'url'            => get_permalink( (int) $post_id ),
    236239                );
    237240
    238241                $items = $menus->load_available_items_query( 'post_type', 'post', 0 );
    239                 $this->assertContains( $expected, $items );
     242                $this->assertContains( $expected, $items, "Items:\n" . var_export( $items, true ) );
    240243        }
    241244
     
    253256                // Expected menu item array.
    254257                $expected = array(
    255                         'id'         => "term-{$term_id}",
    256                         'title'      => 'Term Title',
    257                         'type'       => 'taxonomy',
    258                         'type_label' => 'Category',
    259                         'object'     => 'category',
    260                         'object_id'  => intval( $term_id ),
    261                         'url'        => get_term_link( intval( $term_id ), 'category' ),
     258                        'id'             => "term-{$term_id}",
     259                        'title'          => 'Term Title',
     260                        'original_title' => 'Term Title',
     261                        'type'           => 'taxonomy',
     262                        'type_label'     => 'Category',
     263                        'object'         => 'category',
     264                        'object_id'      => (int) $term_id,
     265                        'url'            => get_term_link( (int) $term_id, 'category' ),
    262266                );
    263267
    264268                $items = $menus->load_available_items_query( 'taxonomy', 'category', 0 );
    265                 $this->assertContains( $expected, $items );
     269                $this->assertContains( $expected, $items, "Items:\n" . var_export( $items, true ) );
    266270        }
    267271
     
    288292
    289293                $items = $menus->load_available_items_query( 'custom_type', 'custom_object', 0 );
    290                 $this->assertContains( $expected, $items );
     294                $this->assertContains( $expected, $items, "Items:\n" . var_export( $items, true ) );
    291295        }
    292296
Note: See TracChangeset for help on using the changeset viewer.