Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLANET-7714 Fix Sentry errors #2490

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,9 @@ function render_navigation_block(array $attributes): string
// For parent pages, get the previous and next siblings in the menu order
$output = '';
$siblings = array_filter($menu_items, function ($item) use ($nav_menu_item) {
return $item->menu_item_parent === $nav_menu_item->menu_item_parent;
return $item !== null
&& $nav_menu_item !== null
&& $item->menu_item_parent === $nav_menu_item->menu_item_parent;
Comment on lines +417 to +419
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it simpler?

Suggested change
return $item !== null
&& $nav_menu_item !== null
&& $item->menu_item_parent === $nav_menu_item->menu_item_parent;
return $item && $nav_menu_item && $item->menu_item_parent === $nav_menu_item->menu_item_parent;

});

$siblings = array_values($siblings);
Expand All @@ -435,7 +437,7 @@ function render_navigation_block(array $attributes): string
// For child pages, only show link to the parent
if ($submenu_page->menu_item_parent !== 0) {
$parent_item = array_filter($menu_items, function ($item) use ($submenu_page) {
return (int) $item->ID === (int) $submenu_page->menu_item_parent;
return $submenu_page !== null && (int) $item->ID === (int) $submenu_page->menu_item_parent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
return $submenu_page !== null && (int) $item->ID === (int) $submenu_page->menu_item_parent;
return $item && $submenu_page && (int) $item->ID === (int) $submenu_page->menu_item_parent;

});

$parent_item = reset($parent_item);
Expand Down
4 changes: 2 additions & 2 deletions src/GravityFormsExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -676,11 +676,11 @@ public function p4_gf_clear_page_caches(array $form, bool $is_new = false): void
/**
* Client side dynamic population of form fields
*
* @param array $form The different form fields present
* @param array|bool $form The different form fields present
*
* @return mixed
*/
public function p4_client_side_gravityforms_prefill(array $form): array
public function p4_client_side_gravityforms_prefill($form): array
{
$supported_field_types = ['GF_Field_Hidden'];

Expand Down
6 changes: 3 additions & 3 deletions src/Migrations/M032MigrateSplit2ColumnBlock.php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to modify a migration script that was already run?

Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ private static function get_split_2_columns_block_attrs(array $block): array
$block_attrs['column1']['title'] = $block['title'] ?? '';
$block_attrs['column1']['description'] = wp_trim_words($block['issue_description'] ?? '', 12);
$block_attrs['column1']['link_text'] = $block['issue_link_text'] ?? '';
$block_attrs['column1']['link_path'] = $block['issue_link_path'] ?? '';
$block_attrs['column1']['link_path'] = (string)$block['issue_link_path'] ?? '';
$block_attrs['column1']['image_id'] = $block['issue_image_id'] ?? '';
$block_attrs['column1']['image_src'] = $block['issue_image_src'] ?? '';
$block_attrs['column1']['image_src'] = (string)$block['issue_image_src'] ?? '';

$block_attrs['column2']['title'] = $block['tag_name'] ?? '';
$block_attrs['column2']['description'] = wp_trim_words($block['tag_description'] ?? '', 12);
$block_attrs['column2']['button_text'] = $block['button_text'] ?? '';
$block_attrs['column2']['button_link'] = $block['button_link'] ?? '';
$block_attrs['column2']['link_path'] = $block['tag_link'] ?? '';
$block_attrs['column2']['image_id'] = $block['tag_image_id'] ?? '';
$block_attrs['column2']['image_src'] = $block['tag_image_src'] ?? '';
$block_attrs['column2']['image_src'] = (string)$block['tag_image_src'] ?? '';

return $block_attrs;
}
Expand Down
6 changes: 3 additions & 3 deletions tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
}

$tag = get_queried_object();
$redirect_id = get_term_meta($tag->term_id, 'redirect_page', true);
$redirect_id = $tag !== null && get_term_meta($tag->term_id, 'redirect_page', true);
$redirect_page = get_post($redirect_id);

if ($redirect_id) {
if ($redirect_page) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, double-check that this is working as expected.
I've done something similar here, which caused some trouble as you can see here.

global $wp_query;
$redirect_page = get_post($redirect_id);
$wp_query->queried_object = $redirect_page;
$wp_query->queried_object_id = $redirect_page->ID;

Expand Down