Attempt to read property “ID” on null error with Icegram Express plugin

A PHP warning from the HivePress plug-in appears on each of the workflow edit pages of the Icegram Express plugin-in:

Warning: Attempt to read property "ID" on null in /home/httpd/vhosts/[domain.tld]/httpdocs/wp-content/plugins/hivepress/includes/components/class-admin.php on line 1138

Example page: https://[domain.tld]/wp-admin/admin.php?page=es_workflows&action=edit&id=6

The warning still appears after deactivating all third-party plugins and disabling custom snippets.

HivePress 1.7.10
Icegram Express: 5.7.47
PHP: 8.2.25

Steps to reproduce

  1. Install and activate HivePress.
  2. Install and activate Icegram Express.
  3. Go to Icegram Express, Workflows
  4. Edit any workflow and see the warning on top of the page

Actual result

PHP warning appears

Expected result

No PHP warning appears

Extra details

The Icegram support staff informed that it seems that the issue originates from the HivePress plugin and is not related to Icegram Express and recommended to reach out to HivePress.

Hi,

Thanks for the detailed bug report. I inspected the code part where the error is triggered and this may be an Icegram Express issue, please try contacting their support again with these details:

The error occurs because the core WordPress filter hook add_meta_boxes stops passing the second parameter $post (or passes null) on Icegram Express pages for some reason add_meta_boxes – Hook | Developer.WordPress.org Please check if Icegram Express somehow uses/affects this filter hook, it should pass the post object as a second parameter as documented in WordPress, maybe one of the callback functions added to this hook affects this.

On our side, we’ll add another check if the post object is not null (in the next update), but it shouldn’t be null in any case as per the WordPress documentation.

Thanks very much for checking, @ihor .
I shared your info with the Icegram support and will close this topic when resolved.

Hi @ihor,

I got this message for you from Icegram:

Currently Express plugin need to trigger ‘add_meta_boxes’ action hook to render WordPress meta boxes on its workflow page.

Since workflow are stored in custom table and aren’t stored in the way other WordPress post or custom post types are stored, therefore loading workflow as a post won’t be possible currently.

Therefore before accessing post, if HivePress team can add checks for post is not null in their plugin that would be great.

No worries, we’ll change this in the next update, if it’s urgent please make the same change manually before the official release (e.g. via Plugins/Plugin Editor/HivePress):

Thanks very much, @ihor.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.