PHP warning message breaks saving Forms
-
When full PHP warnings are enabled, saving an ACF Extended form will break when the page tries to render after reloading, due to the warning being interpreted as an HTTP header.
These are the errors displayed – rest of page is a white-screen-of-death:
Notice: Undefined index: post in /var/www/html/wp-content/plugins/acf-extended/includes/modules/form/admin.php on line 175 Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/acf-extended/includes/modules/form/admin.php:175) in /var/www/html/wp-includes/pluggable.php on line 1281Looking at the line containing the first warning, I see:
$form_id = $_REQUEST['post'];Presumably the root cause of the error is due to there being no actual post on the admin-side.
Replacing with this made the issue go away:
$form_id = ! empty( $_REQUEST['post'] ) ? $_REQUEST['post'] : null;The code following the line seems to accept the null, and fail gracefully with no warnings or errors.
The topic ‘PHP warning message breaks saving Forms’ is closed to new replies.