Bug #20674 Version Retired

Channel Form “Undefined index: CONTENT_LENGTH”

Version: 2.9.2 Reporter: HLegge

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

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;
}
  • 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())
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases