Skip Navigation

[Resolved] PHP Deprecated: cred__return_zero is deprecated since version

This support ticket is created 4 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Christian Cox 4 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1706503

When adding a clean new Add Posts Form to a page, and submitting it, this error is logged:

PHP Deprecated:  cred__return_zero is <strong>deprecated</strong> since version 2.5.7! Use __return_zero instead. in /Applications/MAMP/htdocs/formclean/wp-includes/functions.php on line 4713

Trace:

[14-Jul-2020 10:22:05 UTC] PHP Stack trace:
[14-Jul-2020 10:22:05 UTC] PHP   1. {main}() /Applications/MAMP/htdocs/formclean/index.php:0
[14-Jul-2020 10:22:05 UTC] PHP   2. require() /Applications/MAMP/htdocs/formclean/index.php:17
[14-Jul-2020 10:22:05 UTC] PHP   3. require_once() /Applications/MAMP/htdocs/formclean/wp-blog-header.php:19
[14-Jul-2020 10:22:05 UTC] PHP   4. include() /Applications/MAMP/htdocs/formclean/wp-includes/template-loader.php:106
[14-Jul-2020 10:22:05 UTC] PHP   5. get_template_part() /Applications/MAMP/htdocs/formclean/wp-content/themes/twentytwenty/singular.php:24
[14-Jul-2020 10:22:05 UTC] PHP   6. locate_template() /Applications/MAMP/htdocs/formclean/wp-includes/general-template.php:168
[14-Jul-2020 10:22:05 UTC] PHP   7. load_template() /Applications/MAMP/htdocs/formclean/wp-includes/template.php:672
[14-Jul-2020 10:22:05 UTC] PHP   8. require() /Applications/MAMP/htdocs/formclean/wp-includes/template.php:725
[14-Jul-2020 10:22:05 UTC] PHP   9. the_content() /Applications/MAMP/htdocs/formclean/wp-content/themes/twentytwenty/template-parts/content.php:36
[14-Jul-2020 10:22:05 UTC] PHP  10. apply_filters() /Applications/MAMP/htdocs/formclean/wp-includes/post-template.php:253
[14-Jul-2020 10:22:05 UTC] PHP  11. WP_Hook->apply_filters() /Applications/MAMP/htdocs/formclean/wp-includes/plugin.php:206
[14-Jul-2020 10:22:05 UTC] PHP  12. do_shortcode() /Applications/MAMP/htdocs/formclean/wp-includes/class-wp-hook.php:287
[14-Jul-2020 10:22:05 UTC] PHP  13. preg_replace_callback() /Applications/MAMP/htdocs/formclean/wp-includes/shortcodes.php:218
[14-Jul-2020 10:22:05 UTC] PHP  14. do_shortcode_tag() /Applications/MAMP/htdocs/formclean/wp-includes/shortcodes.php:218
[14-Jul-2020 10:22:05 UTC] PHP  15. CRED_Helper::credFormShortcode() /Applications/MAMP/htdocs/formclean/wp-includes/shortcodes.php:343
[14-Jul-2020 10:22:05 UTC] PHP  16. CRED_Helper::cred_form() /Applications/MAMP/htdocs/formclean/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/CRED_Helper.php:2460
[14-Jul-2020 10:22:05 UTC] PHP  17. CRED_Form_Builder->get_form() /Applications/MAMP/htdocs/formclean/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/CRED_Helper.php:1864
[14-Jul-2020 10:22:05 UTC] PHP  18. CRED_Form_Post->print_form() /Applications/MAMP/htdocs/formclean/wp-content/plugins/cred-frontend-editor/application/controllers/form_builder_base.php:40
[14-Jul-2020 10:22:05 UTC] PHP  19. CRED_Form_Post->save_form() /Applications/MAMP/htdocs/formclean/wp-content/plugins/cred-frontend-editor/application/models/form/base.php:441
[14-Jul-2020 10:22:05 UTC] PHP  20. CRED_Forms_Model->updatePost() /Applications/MAMP/htdocs/formclean/wp-content/plugins/cred-frontend-editor/application/models/form/post.php:592
[14-Jul-2020 10:22:05 UTC] PHP  21. wp_update_post() /Applications/MAMP/htdocs/formclean/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/models/Forms.php:717
[14-Jul-2020 10:22:05 UTC] PHP  22. wp_insert_post() /Applications/MAMP/htdocs/formclean/wp-includes/post.php:4244
[14-Jul-2020 10:22:05 UTC] PHP  23. do_action() /Applications/MAMP/htdocs/formclean/wp-includes/post.php:4127
[14-Jul-2020 10:22:05 UTC] PHP  24. WP_Hook->do_action() /Applications/MAMP/htdocs/formclean/wp-includes/plugin.php:478
[14-Jul-2020 10:22:05 UTC] PHP  25. WP_Hook->apply_filters() /Applications/MAMP/htdocs/formclean/wp-includes/class-wp-hook.php:311
[14-Jul-2020 10:22:05 UTC] PHP  26. wp_save_post_revision() /Applications/MAMP/htdocs/formclean/wp-includes/class-wp-hook.php:289
[14-Jul-2020 10:22:05 UTC] PHP  27. wp_revisions_enabled() /Applications/MAMP/htdocs/formclean/wp-includes/revision.php:129
[14-Jul-2020 10:22:05 UTC] PHP  28. wp_revisions_to_keep() /Applications/MAMP/htdocs/formclean/wp-includes/revision.php:511
[14-Jul-2020 10:22:05 UTC] PHP  29. apply_filters() /Applications/MAMP/htdocs/formclean/wp-includes/revision.php:550
[14-Jul-2020 10:22:05 UTC] PHP  30. WP_Hook->apply_filters() /Applications/MAMP/htdocs/formclean/wp-includes/plugin.php:206
[14-Jul-2020 10:22:05 UTC] PHP  31. cred__return_zero() /Applications/MAMP/htdocs/formclean/wp-includes/class-wp-hook.php:287
[14-Jul-2020 10:22:05 UTC] PHP  32. _deprecated_function() /Applications/MAMP/htdocs/formclean/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/common/functions.php:70
[14-Jul-2020 10:22:05 UTC] PHP  33. trigger_error() /Applications/MAMP/htdocs/formclean/wp-includes/functions.php:4713

To me, it's not clear why dev left this function and why it's used, see:

1. cred-frontend-editor/application/models/form/base.php:219

add_filter( 'wp_revisions_to_keep', 'cred__return_zero', 10, 2 );

2. cred-frontend-editor/library/toolset/cred/embedded/common/functions.php:63-70

if ( ! function_exists( 'cred__return_zero' ) ) {

	/**
	 * @return int
	 * @deprecated 2.5.7
	 */
	function cred__return_zero() {
		_deprecated_function( __FUNCTION__, '2.5.7', '__return_zero' );

		return __return_zero();
	}

}

Logically, if we deprecate a function we should also not use anymore that function in a filter.

But I might be missing something?

I replicated this on fresh, by simply creating a new Create Posts form, add that to a page using Blocks, and submit the form (make sure to have your debug statements enabled)

#1707237

Hey Beda! Thanks for the report and details. I replicated this on my local environment too. I will pass this along to Nigel for second tier investigation and escalation as needed. I'll let you know what I find out.

#1707739

Already noted and resolved by our developers, and the fix will be included in the next release of Forms - thanks Beda!