Skip to content

Commit 98e2dd2

Browse files
committed
Merge branch 'release/19.12' of github.com:Yoast/wordpress-seo into trunk
2 parents b47b18c + 0578c5f commit 98e2dd2

8 files changed

Lines changed: 58 additions & 13 deletions

File tree

admin/class-gutenberg-compatibility.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
1515
*
1616
* @var string
1717
*/
18-
const CURRENT_RELEASE = '14.7.0';
18+
const CURRENT_RELEASE = '14.7.1';
1919

2020
/**
2121
* The minimally supported version of Gutenberg by the plugin.
2222
*
2323
* @var string
2424
*/
25-
const MINIMUM_SUPPORTED = '14.7.0';
25+
const MINIMUM_SUPPORTED = '14.7.1';
2626

2727
/**
2828
* Holds the current version.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"typescript": "^4.2.4"
8585
},
8686
"yoast": {
87-
"pluginVersion": "19.12-RC9"
87+
"pluginVersion": "19.12-RC10"
8888
},
8989
"version": "0.0.0"
9090
}

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ Release date: December 13th, 2022
267267
#### Bugfixes
268268

269269
* Fixes a bug that would affect users managing the cron jobs with a plugin on PHP 8.1 after they have performed a core upgrade.
270+
* Fixes a bug where a fatal error would be thrown when trying to create breadcrumbs from unindexable items.
270271
* Fixes a bug where blocks with a NULL `blockName` would trigger deprecation errors with PHP 8.1 and cause performance issues. Props to [@dustyf](https://github.com/dustyf).
271272
* Fixes a bug where breadcrumbs markup would not validate due to improper nesting and closing of span tags. Props to [@michaelbourne](https://github.com/michaelbourne).
272273
* Fixes a bug where highlighting would not be removed from the text after the analysis is updated and the present highlighting has become irrelevant.

src/generators/breadcrumbs-generator.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,22 @@ public function generate( Meta_Tags_Context $context ) {
9797
if ( $breadcrumbs_home !== '' && ! \in_array( $this->current_page_helper->get_page_type(), [ 'Home_Page', 'Static_Home_Page' ], true ) ) {
9898
$front_page_id = $this->current_page_helper->get_front_page_id();
9999
if ( $front_page_id === 0 ) {
100-
$static_ancestors[] = $this->repository->find_for_home_page();
100+
$home_page_ancestor = $this->repository->find_for_home_page();
101+
if ( \is_a( $home_page_ancestor, Indexable::class ) ) {
102+
$static_ancestors[] = $home_page_ancestor;
103+
}
101104
}
102105
else {
103106
$static_ancestor = $this->repository->find_by_id_and_type( $front_page_id, 'post' );
104-
if ( $static_ancestor->post_status !== 'unindexed' ) {
107+
if ( \is_a( $static_ancestor, Indexable::class ) && $static_ancestor->post_status !== 'unindexed' ) {
105108
$static_ancestors[] = $static_ancestor;
106109
}
107110
}
108111
}
109112
$page_for_posts = \get_option( 'page_for_posts' );
110113
if ( $this->should_have_blog_crumb( $page_for_posts, $context ) ) {
111114
$static_ancestor = $this->repository->find_by_id_and_type( $page_for_posts, 'post' );
112-
if ( $static_ancestor->post_status !== 'unindexed' ) {
115+
if ( \is_a( $static_ancestor, Indexable::class ) && $static_ancestor->post_status !== 'unindexed' ) {
113116
$static_ancestors[] = $static_ancestor;
114117
}
115118
}
@@ -119,12 +122,18 @@ public function generate( Meta_Tags_Context $context ) {
119122
&& $context->indexable->object_sub_type !== 'page'
120123
&& $this->post_type_helper->has_archive( $context->indexable->object_sub_type )
121124
) {
122-
$static_ancestors[] = $this->repository->find_for_post_type_archive( $context->indexable->object_sub_type );
125+
$static_ancestor = $this->repository->find_for_post_type_archive( $context->indexable->object_sub_type );
126+
if ( \is_a( $static_ancestor, Indexable::class ) ) {
127+
$static_ancestors[] = $static_ancestor;
128+
}
123129
}
124130
if ( $context->indexable->object_type === 'term' ) {
125131
$parent = $this->get_taxonomy_post_type_parent( $context->indexable->object_sub_type );
126132
if ( $parent && $parent !== 'post' && $this->post_type_helper->has_archive( $parent ) ) {
127-
$static_ancestors[] = $this->repository->find_for_post_type_archive( $parent );
133+
$static_ancestor = $this->repository->find_for_post_type_archive( $parent );
134+
if ( \is_a( $static_ancestor, Indexable::class ) ) {
135+
$static_ancestors[] = $static_ancestor;
136+
}
128137
}
129138
}
130139

@@ -137,6 +146,13 @@ public function generate( Meta_Tags_Context $context ) {
137146
}
138147

139148
$indexables = \apply_filters( 'wpseo_breadcrumb_indexables', $indexables, $context );
149+
$indexables = \is_array( $indexables ) ? $indexables : [];
150+
$indexables = \array_filter(
151+
$indexables,
152+
function ( $indexable ) {
153+
return \is_a( $indexable, Indexable::class );
154+
}
155+
);
140156

141157
$callback = function ( Indexable $ancestor ) {
142158
$crumb = [

src/integrations/third-party/woocommerce.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ public function add_shop_to_breadcrumbs( $indexables ) {
178178

179179
foreach ( $indexables as $index => $indexable ) {
180180
if ( $indexable->object_type === 'post-type-archive' && $indexable->object_sub_type === 'product' ) {
181-
$indexables[ $index ] = $this->repository->find_by_id_and_type( $shop_page_id, 'post' );
181+
$shop_page_indexable = $this->repository->find_by_id_and_type( $shop_page_id, 'post' );
182+
if ( \is_a( $shop_page_indexable, Indexable::class ) ) {
183+
$indexables[ $index ] = $shop_page_indexable;
184+
}
182185
}
183186
}
184187

tests/unit/integrations/third-party/woocommerce-test.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Yoast\WP\SEO\Helpers\Woocommerce_Helper;
1313
use Yoast\WP\SEO\Integrations\Third_Party\WooCommerce;
1414
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
15+
use Yoast\WP\SEO\Models\Indexable;
1516
use Yoast\WP\SEO\Presentations\Indexable_Presentation;
1617
use Yoast\WP\SEO\Repositories\Indexable_Repository;
1718
use Yoast\WP\SEO\Tests\Unit\Doubles\Models\Indexable_Mock;
@@ -185,9 +186,33 @@ public function test_add_shop_to_breadcrumbs() {
185186
->once()
186187
->andReturn( 707 );
187188

188-
$this->repository->expects( 'find_by_id_and_type' )->once()->with( 707, 'post' )->andReturn( 'shop' );
189+
$indexable_mock = Mockery::mock( Indexable::class );
189190

190-
$this->assertEquals( [ 'shop' ], $this->instance->add_shop_to_breadcrumbs( $indexables ) );
191+
$this->repository->expects( 'find_by_id_and_type' )->once()->with( 707, 'post' )->andReturn( $indexable_mock );
192+
193+
$this->assertEquals( [ $indexable_mock ], $this->instance->add_shop_to_breadcrumbs( $indexables ) );
194+
}
195+
196+
/**
197+
* Tests the add shop to breadcrumbs function when finding no indexable for the shop page.
198+
*
199+
* @covers ::add_shop_to_breadcrumbs
200+
*/
201+
public function test_add_shop_to_breadcrumbs_no_indexable_shop_page() {
202+
$indexables = [
203+
(object) [
204+
'object_type' => 'post-type-archive',
205+
'object_sub_type' => 'product',
206+
],
207+
];
208+
209+
$this->woocommerce_helper->expects( 'get_shop_page_id' )
210+
->once()
211+
->andReturn( 707 );
212+
213+
$this->repository->expects( 'find_by_id_and_type' )->once()->with( 707, 'post' )->andReturn( false );
214+
215+
$this->assertEquals( $indexables, $this->instance->add_shop_to_breadcrumbs( $indexables ) );
191216
}
192217

193218
/**

wp-seo-main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* {@internal Nobody should be able to overrule the real version number as this can cause
1616
* serious issues with the options, so no if ( ! defined() ).}}
1717
*/
18-
define( 'WPSEO_VERSION', '19.12-RC9' );
18+
define( 'WPSEO_VERSION', '19.12-RC10' );
1919

2020

2121
if ( ! defined( 'WPSEO_PATH' ) ) {

wp-seo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* @wordpress-plugin
1010
* Plugin Name: Yoast SEO
11-
* Version: 19.12-RC9
11+
* Version: 19.12-RC10
1212
* Plugin URI: https://yoa.st/1uj
1313
* Description: The first true all-in-one SEO solution for WordPress, including on-page content analysis, XML sitemaps and much more.
1414
* Author: Team Yoast

0 commit comments

Comments
 (0)