PHP error
-
So, came across a kinda of neat ol' error. Unsure if it's related to other tickets, doesn't appear to look like it is from first glance, but i could be wrong.
My lab (192.168.56.1:8030) I installed wpforms on. Then these requests:
curl -s -v 'http://192.168.56.1:8030/wp-admin/admin.php?page[]=elementor' -o /dev/null
curl -s -v 'http://192.168.56.1:8030/wp-admin/admin.php?page[]=wpforms' -o /dev/null
and
curl -s -o /dev/null 'http://192.168.56.1:8030/?page[]=anything'
all produce the same error in debug logs:
[12-Oct-2025 14:51:54 UTC] PHP Fatal error: Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in /var/www/html/wp-content/plugins/wpforms-lite/includes/functions/checks.php:199
Stack trace:
#0 /var/www/html/wp-content/plugins/wpforms-lite/includes/functions/checks.php(199): strpos(Array, 'wpforms')
#1 /var/www/html/wp-content/plugins/wpforms-lite/src/Loader.php(525): wpforms_is_admin_page('overview')
#2 /var/www/html/wp-content/plugins/wpforms-lite/src/Loader.php(45): WPForms\Loader->populate_forms_overview()
#3 /var/www/html/wp-content/plugins/wpforms-lite/src/Loader.php(28): WPForms\Loader->populate_classes()
#4 /var/www/html/wp-content/plugins/wpforms-lite/src/WPForms.php(429): WPForms\Loader->init()
#5 /var/www/html/wp-content/plugins/wpforms-lite/src/WPForms.php(436): WPForms\WPForms->WPForms\{closure}()
#6 /var/www/html/wp-content/plugins/wpforms-lite/src/WPForms.php(290): WPForms\WPForms->register(Array)
#7 /var/www/html/wp-content/plugins/wpforms-lite/src/WPForms.php(224): WPForms\WPForms->includes_magic()
#8 /var/www/html/wp-content/plugins/wpforms-lite/src/WPForms.php(161): WPForms\WPForms->includes()
#9 /var/www/html/wp-content/plugins/wpforms-lite/src/WPForms.php(141): WPForms\WPForms->init()
#10 /var/www/html/wp-content/plugins/wpforms-lite/src/WPForms.php(608): WPForms\WPForms::instance()
#11 /var/www/html/wp-content/plugins/wpforms-lite/wpforms.php(250): wpforms()
#12 /var/www/html/wp-settings.php(545): include_once('/var/www/html/w...')
#13 /var/www/html/wp-config.php(145): require_once('/var/www/html/w...')
#14 /var/www/html/wp-load.php(50): require_once('/var/www/html/w...')
#15 /var/www/html/wp-blog-header.php(13): require_once('/var/www/html/w...')
#16 /var/www/html/index.php(17): require('/var/www/html/w...')
#17 {main}
thrown in /var/www/html/wp-content/plugins/wpforms-lite/includes/functions/checks.php on line 199
Checking that line, i found this:
192 function wpforms_is_admin_page( $slug = '', $view = '' ): bool {
193
194 // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
195
196 // Check against basic requirements.
197 if (
198 empty( $_REQUEST['page'] ) ||
199 strpos( $_REQUEST['page'], 'wpforms' ) === false ||
200 ! is_admin()
201 ) {
202 return false;
203 }
which seems to be a pretty simple strpos not able to handle arrays or other non-strings properly.
not sure if relevant but grepping similiar situations:
wp-content/plugins/wpforms-lite/src/Admin/Dashboard/Widget.php:301: return wpforms_is_admin_ajax() && isset( $_REQUEST['action'] ) && strpos( sanitize_key( $_REQUEST['action'] ), 'wpforms_dash_widget' ) !== false;
wp-content/plugins/wpforms-lite/src/Forms/Akismet.php:171: isset( $_REQUEST['page_url'] ) && strpos( wp_unslash( $_REQUEST['page_url'] ), 'wpforms_form_preview' ) !== false &&
wp-content/plugins/wpforms-lite/includes/functions/checks.php:199: strpos( $_REQUEST['page'], 'wpforms' ) === false |
This is just from a lab I setup recently in a container, this could entirely just be my environment, but wanted to share, for what it's worth.
docker-compose.yml
services:
wordpress:
image: wordpress:latest
ports:
- "8030:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: tester
WORDPRESS_DB_PASSWORD: tester
WORDPRESS_DB_NAME: wordpress
depends_on:
- db
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: tester
MYSQL_PASSWORD: tester
MYSQL_ROOT_PASSWORD: roottesterIf it’s of no relevance, or matter, feel free to close. But came across this so wanted to share what I could about it.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.