Bug, invalid path in freemius causes PHP Warnings
-
Getting lots of these warnings in
debug.log
when in backend:[04-Feb-2024 22:28:09 UTC] PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in ../wp-includes/functions.php on line 7247 [04-Feb-2024 22:28:09 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in ../wp-includes/functions.php on line 2187
Reason is invalid path passed to
realpath()
infreemius/start.php
in line 60 which causesfalse
to be passed on towp_normalize_path()
/wp_is_stream()
in WordPress core where astring
is expected and which triggers the above warnings.Current freemius code:
$themes_directory = get_theme_root( get_stylesheet() ); $themes_directory_name = basename( $themes_directory ); $theme_candidate_basename = basename( dirname( $fs_root_path ) ) . '/' . basename( $fs_root_path ); if ( $file_path == fs_normalize_path( realpath( trailingslashit( $themes_directory ) . $theme_candidate_basename . '/' . basename( $file_path ) ) ) ) {
It creates an invalid path (to
themes
folder!) similar to this:/homepages/28/d[...]/htdocs/wp-content/themes/password-protected/freemius/start.php
Result of
realpath()
should be checked before normalizing it further.Debug backtrace:
#0 ../wp-includes/functions.php(2180): wp_is_stream(false) #1 ../wp-content/plugins/password-protected/freemius/includes/fs-essential-functions.php(27): wp_normalize_path(false) #2 ../wp-content/plugins/password-protected/freemius/start.php(60): fs_normalize_path(false) #3 ../wp-content/plugins/password-protected/includes/freemius.php(21): require_once('/homepages/28/d...') #4 ../wp-content/plugins/password-protected/includes/freemius.php(46): pp_free_fs() #5 ../wp-content/plugins/password-protected/password-protected.php(36): require_once('/homepages/28/d...') #6 ../wp-settings.php(473): include_once('/homepages/28/d...') #7 ../wp-config.php(136): require_once('/homepages/28/d...') #8 ../wp-load.php(50): require_once('/homepages/28/d...') #9 ../wp-blog-header.php(13): require_once('/homepages/28/d...') #10 ../index.php(17): require('/homepages/28/d...')
Password Protected 2.6.6 with Freemius 2.5.10, WordPress 6.4.3, PHP 8.1.x
- The topic ‘Bug, invalid path in freemius causes PHP Warnings’ is closed to new replies.