Archived topic
Deprecated code for PHP 8.1
9 replies · Started by roadlink on November 8, 2022
Hi there,
fyi.
Deprecated stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated 1
wp-includes/functions.wp-styles.php:90
Plugin: gp-premium
Hi there,
Any chance you can share the full stack?
Thanks!
Hi Tom,
I will provide whatever you need.
What do you mean with full stack?
Whole error log?
Hi there,
Can we see the stack trace for that particular error.
There should be several lines information after that line in the error.
If need be send the whole error log.
When doing so, can you highlight it and click the code button in the toolbar before submitting the reply.
add whole file here.
We have some other plugins with errors. Sorry file is a bit big.
Wow, that will take us a day and a half lol.
Where you see this line:
Deprecated stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated 1
wp-includes/functions.wp-styles.php:90
What is immediately before and after it ?
OK David you got me here :)
I really don't know.
Let me follow a bit more time and come back to you later.
OK - let us know :)
Hello,
I get the same warning, with the following stack trace:
#0 wp-content/plugins/gp-premium/menu-plus/functions/generate-menu-plus.php(735): wp_add_inline_style('...', NULL)
#1 wp-includes/class-wp-hook.php(308): generate_menu_plus_enqueue_css('')
#2 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#3 wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 wp-includes/script-loader.php(2180): do_action('...')
#5 wp-includes/class-wp-hook.php(308): wp_enqueue_scripts('')
#6 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#7 wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#8 wp-includes/general-template.php(3043): do_action('...')
#9 wp-content/themes/generatepress/header.php(16): wp_head()
#10 wp-includes/template.php(783): require_once('...')
#11 wp-includes/template.php(718): load_template('...', true, Array)
#12 wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
#13 wp-content/themes/generatepress/page.php(17): get_header()
#14 wp-includes/template-loader.php(106): include('...')
#15 wp-blog-header.php(19): require_once('...')
#16 index.php(17): require('...')
Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in wp-includes/functions.wp-styles.php on line 90
PHP 8.1
Wordpress 6.1
GeneratePressVersion: 3.2.2
GPPremium 2.2.1
Thanks for this! Seems WordPress should cast a string in its function there, but we can do our part to make sure it returns a string if nothing exists. Logged here for the next version: https://github.com/tomusborne/generatepress/issues/475