Bug: mismatched arguments passed to str_replace()
-
Hi,
When we used the plugin, we had an error that broke our website.
PHP Fatal error: Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string in wp-content/plugins/secure-copy-content-protection/public/class-secure-copy-content-protection-public.php:1498This appears to be happening when
$searchis a string and$replaceis an array of user roles.Here’s a sample stack trace:
#0 wp-content/plugins/secure-copy-content-protection/public/class-secure-copy-content-protection-public.php(1498): str_replace('%%post_author_r...', Array, '<p>You cannot c...')
#1 wp-content/plugins/secure-copy-content-protection/public/class-secure-copy-content-protection-public.php(1423): Secure_Copy_Content_Protection_Public->sccp_replace_message_variables('<p>You cannot c...', Array)
#2 wp-includes/class-wp-hook.php(324): Secure_Copy_Content_Protection_Public->ays_get_notification_text('')
#3 wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#4 wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 wp-includes/general-template.php(3208): do_action('wp_footer')
#6 wp-content/plugins/elementor-pro/modules/theme-builder/views/theme-support-footer.php(11): wp_footer()
#7 wp-content/plugins/elementor-pro/modules/theme-builder/classes/theme-support.php(115): require('...')
#8 wp-includes/class-wp-hook.php(326): ElementorPro\Modules\ThemeBuilder\Classes\Theme_Support->get_footer(NULL)
#9 wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#10 wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#11 wp-includes/general-template.php(82): do_action('get_footer', NULL, Array)
#12 wp-content/plugins/elementor/modules/page-templates/templates/header-footer.php(30): get_footer()
#13 wp-includes/template-loader.php(106): include('...')
#14 wp-blog-header.php(19): require_once('...')
#15 index.php(17): require('...')
#16 {main}
thrown in wp-content/plugins/secure-copy-content-protection/public/class-secure-copy-content-protection-public.php on line 1498For now, we fixed this by 1) getting the first role from the array if it has values, and 2) skipping
str_replace()call if the array is empty.We’re running this with:
- PHP 8.2
- WordPress 6.8.3
- Secure Copy Content Protection 5.0.2
Thanks for your time!
- This topic was modified 2 months ago by .
- This topic was modified 2 months ago by . Reason: removing some uselessly-short, vague path prefixes from the stack trace
The page I need help with: [log in to see the link]
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.