From 83af73c9f66a8881129dcd97beeababb72f329c4 Mon Sep 17 00:00:00 2001 From: Michal Kleiner Date: Mon, 23 Aug 2021 23:55:13 +1200 Subject: [PATCH] FIX Only use values that are not empty Previously the isset check would still allow falsey values. --- src/Solr/Stores/SolrConfigStore_File.php | 2 +- src/Solr/Stores/SolrConfigStore_Post.php | 4 ++-- src/Solr/Stores/SolrConfigStore_WebDAV.php | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Solr/Stores/SolrConfigStore_File.php b/src/Solr/Stores/SolrConfigStore_File.php index df8494a..33689c7 100644 --- a/src/Solr/Stores/SolrConfigStore_File.php +++ b/src/Solr/Stores/SolrConfigStore_File.php @@ -13,7 +13,7 @@ class SolrConfigStore_File implements SolrConfigStore public function __construct($config) { $this->local = $config['path']; - $this->remote = isset($config['remotepath']) ? $config['remotepath'] : $config['path']; + $this->remote = !empty($config['remotepath']) ? $config['remotepath'] : $config['path']; } public function getTargetDir($index) diff --git a/src/Solr/Stores/SolrConfigStore_Post.php b/src/Solr/Stores/SolrConfigStore_Post.php index 6f90b62..1dc5f29 100644 --- a/src/Solr/Stores/SolrConfigStore_Post.php +++ b/src/Solr/Stores/SolrConfigStore_Post.php @@ -26,12 +26,12 @@ class SolrConfigStore_Post implements SolrConfigStore $this->url = implode('', [ 'http://', - isset($config['auth']) ? $config['auth'] . '@' : '', + !empty($config['auth']) ? $config['auth'] . '@' : '', $options['host'] . ':' . $options['port'], $config['path'] ]); - if (isset($config['remotepath'])) { + if (!empty($config['remotepath'])) { $this->remote = $config['remotepath']; } } diff --git a/src/Solr/Stores/SolrConfigStore_WebDAV.php b/src/Solr/Stores/SolrConfigStore_WebDAV.php index 3d2bbd8..22bfe79 100644 --- a/src/Solr/Stores/SolrConfigStore_WebDAV.php +++ b/src/Solr/Stores/SolrConfigStore_WebDAV.php @@ -18,11 +18,14 @@ class SolrConfigStore_WebDAV implements SolrConfigStore $this->url = implode('', array( 'http://', - isset($config['auth']) ? $config['auth'] . '@' : '', - $options['host'] . ':' . (isset($config['port']) ? $config['port'] : $options['port']), + !empty($config['auth']) ? $config['auth'] . '@' : '', + $options['host'] . ':' . (!empty($config['port']) ? $config['port'] : $options['port']), $config['path'] )); - $this->remote = $config['remotepath']; + + if (!empty($config['remotepath'])) { + $this->remote = $config['remotepath']; + } } public function getTargetDir($index)