Bug #20674 New

Channel Form “Undefined index: CONTENT_LENGTH”

Version: EE 2.9.2 Reporter: HLegge

If you have error_handling=“inline” on and a file fieldtype on a channel form then you get the bellow error. It happens if you submit, receive a standard form error (like “The ‘field name’ is required.”), then go to the the same URL as the error page. The error is due to having for form info/meta still in the url (i.e. ?RET=...)

A PHP Error was encountered
Severity: Notice
Message: Undefined index: CONTENT_LENGTH
Filename: libraries/Filemanager.php
Line Number: 1949

This is the function in question:

public function validate_post_data()
{
 ee()->load->helper('number_helper');
 $post_limit = get_bytes(ini_get('post_max_size'));
 return $_SERVER['CONTENT_LENGTH'] <= $post_limit;
}
  • Nobody has said anything yet.

You must be signed in to comment on a bug report.

  • If you change line 302 of libraries/File_field.php like bellow, it should do the trick (worked for me) but I don’t know if the validate_post_data() function is called anywhere else.

    if ( ! ee()->filemanager->validate_post_data())

    to:

    if ( isset($_SERVER['CONTENT_LENGTH']) && ! ee()->filemanager->validate_post_data())

ExpressionEngine News

#eecms, #events, #releases