Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not complain with PHP >5.6 #38

Open
golendercaria opened this issue Nov 11, 2022 · 1 comment
Open

Not complain with PHP >5.6 #38

golendercaria opened this issue Nov 11, 2022 · 1 comment

Comments

@golendercaria
Copy link

The plugin give a compatibilities with PHP 5.6 or higher, but is not the case.

When I have install the plugin and going to wp-admin/options-general.php?page=facebook_pixel_options I have a blank page and this error on error_log :

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function FacebookPixelPlugin\Core\str_contains() in /var/www/vhosts/xxxx/httpdocs/wp-content/plugins/official-facebook-pixel/core/FacebookWordpressOptions.php:70\nStack trace:\n#0 /var/www/vhosts/xxxx/httpdocs/wp-content/plugins/official-facebook-pixel/core/FacebookWordpressSettingsPage.php(275)...

The reason of this error is str_contains is only implemented on PHP 8 : https://www.php.net/manual/en/function.str-contains.php

For the moment we solve the problem with this little fix, in my functions.php :

	if (!function_exists('str_contains')) {
	    function str_contains($haystack, $needle) {
	        return $needle !== '' && mb_strpos($haystack, $needle) !== false;
	    }
	}
@fbisaso
Copy link
Contributor

fbisaso commented Feb 23, 2023

This will be fixed in the next release.

f318d64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants