Skip Navigation

[Resolved] Deprecated: ctype_digit(): Argument of type WP_Post

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 1 year, 1 month ago.

Assisted by: Nigel.

Author
Posts
#2675071

Hi, we see the following warning:
Deprecated: ctype_digit(): Argument of type WP_Post will be interpreted as string in the future in /home/***/public_html/***/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group/factory.php on line 134

The WordPress version we use is 6.4.2
The PHP version is 8.1.26
Toolset version is 3.5.1

Here is the function in factory.php :

final protected function get_post( $field_group, $force_query_by_name = false ) {
$fg_post = null;

// when $force_query_by_name is not used, check if a post id is given
Line 134 --->>> if ( ! $force_query_by_name && ( ctype_digit( $field_group ) || is_int( $field_group ) ) && (int) $field_group > 0 ) {
// query by post id
$fg_post = $this->wp_post_factory->load( $field_group );
} else if ( $fg_post = $this->get_field_group_by_name( $field_group ) ) {
// field group found
return $fg_post;
} else if ( $rfg_post = $this->get_repeatable_field_group_by_name( $field_group ) ) {
// rfg found
return $rfg_post;
} else {
// object is already given
$fg_post = $field_group;
}

if( $fg_post instanceof WP_Post && $this->get_post_type() === $fg_post->post_type ) {
return $fg_post;
}

return null;
}

Could you please help?

#2675461

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Thanks for reporting this. I see where in the code this can trigger the deprecation notice (passing a WP_Post object to the get_post function rather than a string with the post ID).

I have reported this to the developers, and it should be an easy fix we can include in Types, likely in the next release.

In the meantime, note that this has no effect on the functionality of your site.