PHP Notice – incorrectly assumes posted values exist
-
Hi Takayuki Miyoshi (Plugin Author),
Noticed this error in my logs…
It appears that inside the
wpcf7_text_validation_filter
function there is an assumption that all the form arguments were posted … this is not always the case (i.e. when spammers post).The line causing the PHP notice:
$_POST[$name] = trim( strtr( (string) $_POST[$name], "\n", " " ) );
Detailed log, note that
username
was not posted but did exist in the form:URL: https://example.com/signup/ Referrer: https://example.com/signup/ Error(E_NOTICE): Undefined index: username Source: /var/sites/g/example.com/public_html/wp-content/plugins/contact-form-7/modules/text.php [124] Trace: #1 /var/sites/g/example.com/public_html/index.php:17 - require('/var/si...') #2 /var/sites/g/example.com/public_html/wp-blog-header.php:12 - require_once('/var/si...') #3 /var/sites/g/example.com/public_html/wp-load.php:29 - require_once('/var/si...') #4 /var/sites/g/example.com/public_html/wp-config.php:153 - require_once('/var/si...') #5 /var/sites/g/example.com/public_html/wp-settings.php:302 - do_action('init') #6 /var/sites/g/example.com/public_html/wp-includes/plugin.php:403 - call_user_func_array('wpcf7_c...', Array) #7 [internal call] - wpcf7_control_init('') #8 /var/sites/g/example.com/public_html/wp-content/plugins/contact-form-7/includes/controller.php:8 - wpcf7_submit_nonajax() #9 /var/sites/g/example.com/public_html/wp-content/plugins/contact-form-7/includes/controller.php:121 - WPCF7_ContactForm->submit() #10 /var/sites/g/example.com/public_html/wp-content/plugins/contact-form-7/includes/classes.php:362 - WPCF7_ContactForm->validate() #11 /var/sites/g/example.com/public_html/wp-content/plugins/contact-form-7/includes/classes.php:418 - apply_filters('wpcf7_v...', Array, Array) #12 /var/sites/g/example.com/public_html/wp-includes/plugin.php:170 - call_user_func_array('wpcf7_t...', Array) #13 [internal call] - wpcf7_text_validation_filter(Array, Array) POST: array ( 'SUdomains' => 'null', 'SUusername' => '[email protected]', 'SUpassword' => 'adaxiaoF0', 'SUverifypassword' => 'adaxiaoF0', 'SUfirstname' => 'Smith', 'SUTOS' => 'on', 'SUbirth_Month' => '07', 'SUbirth_Day' => '15', 'SUbirth_Year' => '1980', 'SUzip' => '518000', 'SUcountry' => 'CN', 'SUcouponcode' => '', 'signupSubmit' => '', '_wpcf7' => '59', '_wpcf7_version' => '3.3.2', '_wpcf7_unit_tag' => 'wpcf7-f59-p52-o1', '_wpnonce' => '520c7e51b1', ) GET: array ( )
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP Notice – incorrectly assumes posted values exist’ is closed to new replies.