Skip to content

Commit

Permalink
Ensure that the URL has a trailing slash. This ensures that the PHP_U…
Browse files Browse the repository at this point in the history
…RL_PATH is always set, which prevents the str_replace() call from outputting "Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated"
  • Loading branch information
wpscholar committed Feb 22, 2024
1 parent f49f76c commit 3f05819
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/CacheTypes/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use NewfoldLabs\WP\Module\Performance\Performance;
use NewfoldLabs\WP\ModuleLoader\Container;
use WP_Forge\WP_Htaccess_Manager\htaccess;

use wpscholar\Url;

use function NewfoldLabs\WP\Module\Performance\getCacheLevel;
use function NewfoldLabs\WP\Module\Performance\removeDirectory;
use function NewfoldLabs\WP\Module\Performance\shouldCachePages;
Expand Down Expand Up @@ -299,7 +299,7 @@ protected function getStoragePathForRequest() {

if ( ! isset( $path ) ) {
$url = new Url();
$basePath = wp_parse_url( home_url(), PHP_URL_PATH );
$basePath = wp_parse_url( home_url('/'), PHP_URL_PATH );
$path = trailingslashit( self::CACHE_DIR . str_replace( $basePath, '', esc_url( $url->path ) ) );
}

Expand Down

0 comments on commit 3f05819

Please sign in to comment.