wearerequired / user-feedback

Collect user feedback directly from your WordPress site
GNU General Public License v2.0
52 stars 8 forks source link

Some data in emails is corrupted #58

Closed antoshk closed 8 years ago

antoshk commented 8 years ago

I always receive feedback email with corrupted fields "Name", "Email" and "Browser":

Name: A Email: (not provided) Browser: A (A)

I tried to dig in code and found that this data is sending as small arrays in big array of all other data. When WordPress receives this big array it passes though sanitize_text_field() function using array_map() function:

$data = array_map( 'sanitize_text_field', $_POST['data'] );

sanitize_text_field() receives as argument the array of user and browser data strings instead of just string and it corrupts this data.

swissspidy commented 8 years ago

Thanks for your report!

Definitely would need to use map_deep there.

IIRC this is already fixed in the feature branch, which will be released soon.

swissspidy commented 8 years ago

After merging #49 this shouldn't be a problem anymore. Now uses array_walk_recursive( $data, 'sanitize_text_field' ). The message, which is a multi-line string from a textarea, is treated separately using array_map().

swissspidy commented 8 years ago

See also: https://wordpress.org/support/topic/not-receiving-supplied-user-info