Skip to content

Commit

Permalink
Fix problems causing fatal errors in the recent release. (#38114)
Browse files Browse the repository at this point in the history
* Added safeguards against null body class.

* Changelog.

* Infinite Scroll: added safeguards against non-initialized Sharing module.

* Changelog.

* Fix fatals when attributes are not an array.

* Project versions.

* Update projects/plugins/jetpack/modules/infinite-scroll/infinity.php

Co-authored-by: Brad Jorsch <[email protected]>

* Remove unneeded precautions.

---------

Co-authored-by: Brad Jorsch <[email protected]>
  • Loading branch information
zinigor and anomiex authored Jun 28, 2024
1 parent 02c6fc3 commit affec6d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/fix-woa-fatals
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Infinite Scroll: fixed a fatal error from uninitialized Sharing module.
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/modules/infinite-scroll/infinity.php
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,11 @@ public function query() {
sharing_register_post_for_share_counts( get_the_ID() );
}

// If sharing counts are not initialized for any reason, we initialize them here.
if ( ! is_array( $jetpack_sharing_counts ) ) {
$jetpack_sharing_counts = array();
}

$results['postflair'] = array_flip( $jetpack_sharing_counts );
}
} else {
Expand Down
6 changes: 6 additions & 0 deletions projects/plugins/jetpack/modules/markdown/easy-markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@ public function wp_kses_allowed_html( $tags, $context ) {

$re = '/' . $this->get_parser()->contain_span_tags_re . '/';
foreach ( $tags as $tag => $attributes ) {

// In case other filters have changed the value to a non-array, we skip it.
if ( ! is_array( $attributes ) ) {
continue;
}

if ( preg_match( $re, $tag ) ) {
$attributes['markdown'] = true;
$tags[ $tag ] = $attributes;
Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/wpcomsh/changelog/fix-woa-fatals
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Wpcomsh: fixed fatal errors in case of null body class values.
2 changes: 1 addition & 1 deletion projects/plugins/wpcomsh/custom-colors/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ public static function register_scripts_and_styles() {
* @param array $classes the array of classes to add custom class to.
*/
public static function body_class( $classes ) {
array_push( $classes, 'custom-colors' );
$classes[] = 'custom-colors';
return $classes;
}

Expand Down

0 comments on commit affec6d

Please sign in to comment.