PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

sprintf() Bug (and Fix)

  1. Due to the lack of support of a static text field, I used a section break to display my note in the description field. When I saved the form, I started getting this error:

    Warning: sprintf() [FUNCTION.SPRINTF]: Too few arguments in [...]wp-content/plugins/gravityforms/form_display.php on line 603

    After poking around a bit I realized that the description had a "%" in it which was breaking the sprintf() function. Rather than put a double % in my text (since it was for a client) I modified gravityforms/form_display.php line 603 to be:

    $field_content = sprintf("%s<h2 class='gsection_title'>%s</h2>".str_replace("%","%%",$description), $admin_buttons, esc_html($field_label));

    So it will automatically escape a % in the description now.

    I hope this post serves as a bug report as well as a request for a) static text fields and b) an official fix for escaping descriptions.

    Posted 14 years ago on Wednesday March 17, 2010 | Permalink