PHPStan issue detected
🐞 bug report
Run a plugin or just phpstan across this project and there will be this php warning.
Versions: (*)
Freemius SDK Version:last versionWordPress Version:whateverPHP Version:7.0+
PHP Warning: Creating default object from empty value in /plugin-name/vendor/freemius/wordpress-sdk/start.php on line 74
Warning: Creating default object from empty value in /plugin-name/vendor/freemius/wordpress-sdk/start.php on line 74
PHP Notice: Trying to get property 'stylesheet' of non-object in /plugin-name/vendor/freemius/wordpress-sdk/includes/fs-essential-functions.php on line 354
Notice: Trying to get property 'stylesheet' of non-object in /plugin-name/vendor/freemius/wordpress-sdk/includes/fs-essential-functions.php on line 354
PHP Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /plugin-name/vendor/freemius/wordpress-sdk/start.php on line 392
Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /plugin-name/vendor/freemius/wordpress-sdk/start.php on line 392
This is very annoying...
Could you please update your original comment with information about your environment, as per the bug report template requirements: https://github.com/Freemius/wordpress-sdk/issues/new?template=1-bug-report.md
Done
Thanks. Are you seeing these notices only with PHPStan?
If you're seeing them in normal plugin operation can you describe the steps so I can try to replicate?
No just with phpstan so is not possible to get a clean output of this tool when is used to maintain the code quality of the plugin.
A user reported seeing this warning PHP Warning: Creating default object from empty value in /wp-content/plugins/video-embed-thumbnail-generator/freemius/start.php on line 74 when updating my plugin to the latest version, which includes the Freemius SDK for the first time. I haven't been able to reproduce the warning myself. They opted out of Freemius but they're concerned that it means they didn't actually opt out. I'm sure that's not what's happening but warnings during activation don't inspire confidence.
The line is https://github.com/Freemius/wordpress-sdk/blob/master/start.php#L74 same line at https://github.com/Freemius/wordpress-sdk/blob/master/start.php#L98
I guess that is better to run this sdk with PHPStan to understand better the issue.