Title: PHP error in Forminator_Select::validate
Last modified: October 14, 2024

---

# PHP error in Forminator_Select::validate

 *  Resolved [peter8nss](https://wordpress.org/support/users/peter8nss/)
 * (@peter8nss)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/)
 * Noticed in my server log the following fatal PHP error:
 *     ```wp-block-code
       Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in /home/sites/1a/4/44afcb079c/public_html/wp-content/plugins/forminator/library/fields/select.php:586\nStack trace:\n#0 /home/sites/1a/4/44afcb079c/public_html/wp-content/plugins/forminator/library/abstracts/abstract-class-field.php(893): Forminator_Select->validate(Array, Array)\n#1 /home/sites/1a/4/44afcb079c/public_html/wp-content/plugins/forminator/library/modules/custom-forms/front/front-action.php(622): Forminator_Field->validate_entry(Array, Array)\n#2 /home/sites/1a/4/44afcb079c/public_html/wp-content/plugins/forminator/library/modules/custom-forms/front/front-action.php(570): Forminator_CForm_Front_Action::set_field_data('select-1', Array, 4)\n#3 /home/sites/1a/4/44afcb079c/public_html/wp-content/plugins/forminator/library/modules/custom-forms/front/front-action.php(501): Forminator_CForm_Front_Action::set_field_data_array(4, Object(Forminator_Form_Field_Model))\n#4 /home/site...'
       ```
   
 * “select-1” is a select field from which I would normally expect to get back a
   string. I think someone has tried to inject an array into this field causing 
   this PHP error in function Forminator_Select::validate.
 * I don’t think the “is required” checking can assume that just because it is processing
   a “single” that a string has actually been supplied. Initially, I thought “empty”
   could be used to cover both “single” and “multiselect” cases, but that wouldn’t
   work if one of the select options was “0”. So perhaps something like the following
   would be a bit more bulletproof:
 *     ```wp-block-code
       if ( $this->is_required( $field ) ) {   if ( ! isset( $data ) ||      ( 'single' === $select_type && ! ( is_string( $data ) && strlen( $data ) > 0 ) ) ||      ( 'multiselect' === $select_type && empty( $data ) )
       ```
   

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Support [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * (@wpmudev-support2)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/#post-18071506)
 * Hello [@peter8nss](https://wordpress.org/support/users/peter8nss/)
 * Hope you are doing well today.
 * The error does not show any clue of a hacker attack it could be due to a bug 
   or code conflict but you are right we can do more checks for that field data.
 * I will bring your issue to our development team to review and investigate further,
   since it’s a rare error I believe it will not happen again so you can ignore 
   it for now, we will try to improve the plugin in future updates.
 * Kind Regards,
    Amin
 *  Plugin Support [Nithin – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport11/)
 * (@wpmudevsupport11)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/#post-18109003)
 * Hi [@peter8nss](https://wordpress.org/support/users/peter8nss/),
 * Since we haven’t heard from you for a while. I’ll mark this thread as resolved
   for now. Please feel free to re-open this thread if you need any further assistance.
 * Kind Regards
   Nithin
 *  Thread Starter [peter8nss](https://wordpress.org/support/users/peter8nss/)
 * (@peter8nss)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/#post-18132631)
 * I have seen these recur on a number of occasions (most recent on 5th November).
   In all cases the IP address suggests it is not one of my users, e.g. it is hackers,
   allbeit unsuccessful AFAIK.
 *  Plugin Support [Imran – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support9/)
 * (@wpmudev-support9)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/#post-18136001)
 * Hello [@peter8nss](https://wordpress.org/support/users/peter8nss/),
   I hope things
   are going well for you. Would you mind sharing more the form export file and 
   site info? so we can review further on that?For the form export you can follow
   this guide:-[https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export](https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export)
   and kindly refer this screenshot for copy site info:-[https://monosnap.com/file/dP0SsOYhF7tyw7dO8eGDbm9UUKkpHY](https://monosnap.com/file/dP0SsOYhF7tyw7dO8eGDbm9UUKkpHY)
 * You can share both using public platform such as using [pastebin.com](https://pastebin.com/).
   In case you would like to share it privately, send an email to [wpsupport@incsub.com](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/wpsupport@incsub.com?output_format=md)
   with this specific subject: **ATTN: WPMU DEV support-wp.org.** In the email body,
   include the form URL and the thread link: [https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/).
 * I hope to hear from you soon
 * –
   Thanks & Kind Regards,Imran Khan
 *  Thread Starter [peter8nss](https://wordpress.org/support/users/peter8nss/)
 * (@peter8nss)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/#post-18138887)
 * I have replied using the email.
 * My guess is that some “bot” is programatically trying to submit the form and 
   providing an array of select values rather than the single one that the form 
   would get if used by a human.
 * So, whilst your code is correct for normal usage, it has not considered a programatic
   form submit. Hence, my suggested change to make the code fail gracefully in this
   case.
 *  Plugin Support [Patrick – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport12/)
 * (@wpmudevsupport12)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/#post-18139806)
 * Hi [@peter8nss](https://wordpress.org/support/users/peter8nss/)
 * Thank you for the form,
 * I made a few tests on my lab site and attempted to simulate an attack passing
   different parameter types to select-1 but none resulted in the fatal error. But
   I can see based on your logs we could improve it.
 * I’ve reported this to our developers.
 * Note, that we can’t give any estimated time or guarantee we will add the additional
   validation as it also requires finding the replication steps, but please keep
   the plugin updated and if you would like to follow our updates you can subscribe
   to [https://wpmudev.com/roadmap#dev-subscribe](https://wpmudev.com/roadmap#dev-subscribe)
 * Best Regards
    Patrick Freitas
 *  Plugin Support [Saurabh – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support7/)
 * (@wpmudev-support7)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/#post-18367148)
 * Hello [@peter8nss](https://wordpress.org/support/users/peter8nss/)
 * Just an update here, we’ve released a fix for this bug in Forminator v1.41.1.
   Please feel free to update the Forminator plugin to the latest version and clear
   all caches (including the browser cache), it should resolve the issue.
 * Please let us know how it goes.
 * Kind Regards
    Saurabh

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘PHP error in Forminator_Select::validate’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

## Tags

 * [validation](https://wordpress.org/support/topic-tag/validation/)

 * 8 replies
 * 6 participants
 * Last reply from: [Saurabh – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support7/)
 * Last activity: [1 year, 2 months ago](https://wordpress.org/support/topic/php-error-in-forminator_selectvalidate/#post-18367148)
 * Status: resolved