Skip to content

Commit

Permalink
Testimonials: Ensure we avoid a division by zero error if the columns…
Browse files Browse the repository at this point in the history
… attribute is set to 0 (#40896)

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12686355275

Upstream-Ref: Automattic/jetpack@359e929
  • Loading branch information
coder-karen authored and matticbot committed Jan 9, 2025
1 parent d91747f commit d032737
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 89 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This is an alpha version! The changes listed here are not final.

### Fixed
- Global Styles: Stop showing the limited global styles notice in distraction free mode.
- Testimonials: fix a shortcode related bug which ccurs if the column attribute is added and set to 0

## 2.6.1 - 2024-11-11
### Changed
Expand Down
60 changes: 30 additions & 30 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions vendor/automattic/jetpack-classic-theme-helper/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.3-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Fixed
- Testimonials: fix a shortcode related bug which ccurs if the column attribute is added and set to 0

## [0.8.2] - 2025-01-06
### Changed
- Updated package dependencies. [#40784] [#40831]
Expand Down Expand Up @@ -185,6 +192,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Add wordpress folder on gitignore. [#37177]

[0.8.3-alpha]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.8.2...v0.8.3-alpha
[0.8.2]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.8.1...v0.8.2
[0.8.1]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.8.0...v0.8.1
[0.8.0]: https://github.com/Automattic/jetpack-classic-theme-helper/compare/v0.7.4...v0.8.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class Main {

const PACKAGE_VERSION = '0.8.2';
const PACKAGE_VERSION = '0.8.3-alpha';

/**
* Modules to include.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,11 @@ private static function get_testimonial_class( $testimonial_index_number, $colum
}
}

// Add a guard clause to prevent division by zero below.
if ( $columns <= 0 ) {
$columns = 1;
}

// add first and last classes to first and last items in a row
if ( ( $testimonial_index_number % $columns ) === 0 ) {
$class[] = 'testimonial-entry-first-item-row';
Expand Down
2 changes: 1 addition & 1 deletion vendor/automattic/jetpack-mu-wpcom/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"automattic/jetpack-assets": "^4.0.2",
"automattic/jetpack-blocks": "^3.0.1",
"automattic/jetpack-calypsoify": "^0.2.1-alpha",
"automattic/jetpack-classic-theme-helper": "^0.8.2",
"automattic/jetpack-classic-theme-helper": "^0.8.3-alpha",
"automattic/jetpack-connection": "^6.2.2",
"automattic/jetpack-masterbar": "^0.10.5",
"automattic/jetpack-redirect": "^3.0.1",
Expand Down
Loading

0 comments on commit d032737

Please sign in to comment.