diff --git a/wire/core/LanguageFunctions.php b/wire/core/LanguageFunctions.php index 9bb52a27..a6518ffd 100644 --- a/wire/core/LanguageFunctions.php +++ b/wire/core/LanguageFunctions.php @@ -111,7 +111,7 @@ function __($text, $textdomain = null, $context = '') { $textArray = false; $encode = $options['entityEncode']; $user = wire('user'); - $language = $user ? $user->language : null; /** @var Language $language */ + $language = $user ? $user->get('language') : null; /** @var Language $language */ if(!is_string($text)) { // getting/setting options or translating with multiple phrases accepted diff --git a/wire/core/WireArray.php b/wire/core/WireArray.php index e40b231e..3b00c874 100644 --- a/wire/core/WireArray.php +++ b/wire/core/WireArray.php @@ -669,7 +669,7 @@ class WireArray extends Wire implements \IteratorAggregate, \ArrayAccess, \Count if(ctype_digit("$key")) return null; $item = null; foreach($this->data as $wire) { - if(is_object($wire)) { + if(is_object($wire) && $wire instanceof Wire) { if($wire->$key === $value) { $item = $wire; break; diff --git a/wire/core/WireLog.php b/wire/core/WireLog.php index 59acd5fe..d0cf140a 100644 --- a/wire/core/WireLog.php +++ b/wire/core/WireLog.php @@ -266,6 +266,19 @@ class WireLog extends Wire { return $this->wire('config')->paths->logs . $name . '.' . $this->logExtension; } + /** + * Does given log name exist? + * + * @param string $name + * @return bool + * @since 3.0.176 + * + */ + public function exists($name) { + $filename = $this->getFilename($name); + return is_file($filename); + } + /** * Return the given number of entries from the end of log file * @@ -447,8 +460,10 @@ class WireLog extends Wire { * */ public function delete($name) { + if(!$this->exists($name)) return false; $log = $this->getFileLog($name); - return $log->delete(); + if($log) return $log->delete(); + return false; } /** @@ -463,6 +478,7 @@ class WireLog extends Wire { * */ public function prune($name, $days) { + if(!$this->exists($name)) return false; $log = $this->getFileLog($name); if($days < 1) throw new WireException("Prune days must be 1 or more"); $oldestDate = strtotime("-$days DAYS");