diff --git a/src/Elements/Traits/MaxlengthTrait.php b/src/Elements/Traits/MaxlengthTrait.php index e754292..2c39019 100644 --- a/src/Elements/Traits/MaxlengthTrait.php +++ b/src/Elements/Traits/MaxlengthTrait.php @@ -21,17 +21,17 @@ public function maxlength($length) /** * Get the max length for text type fields * - * @param string $value + * @param string|null $value * @param string $maxLength * * @return string|\TypeRocket\Html\Html */ - public function getMaxlength( $value, $maxLength ) + public function getMaxlength($value, $maxLength) { $max = ''; if ( $maxLength != null && $maxLength > 0) { - $left = ( (int) $maxLength ) - mb_strlen( $value ); + $left = ( (int) $maxLength ) - mb_strlen( (string) $value ); $max = Html::p(['class' => 'tr-maxlength'], 'Characters left: ')->nest(Html::span($left)); } diff --git a/src/Http/Cookie.php b/src/Http/Cookie.php index 3be2b32..f806e6a 100644 --- a/src/Http/Cookie.php +++ b/src/Http/Cookie.php @@ -3,6 +3,7 @@ use TypeRocket\Utility\Data; use TypeRocket\Utility\Sanitize; +use \TypeRocket\Http\ErrorCollection; class Cookie { @@ -98,7 +99,7 @@ public function set( $name, $data, $time = MINUTE_IN_SECONDS, $path = '/' ) { setcookie($name, $data, apply_filters('typerocket_cookie_options', [ 'expires' => $time === null ? 0 : time() + $time, 'path' => $path, - 'domain' => null, + 'domain' => '', 'secure' => is_ssl() ], $name, $data, $this)); @@ -140,7 +141,7 @@ public function delete( $name, $path = '/' ) { throw new \Exception('Cookie name is required to delete. You provided an empty string or null.'); } - setcookie($name, "", time() - 36000, $path, null, is_ssl()); + setcookie($name, "", time() - 36000, $path, '', is_ssl()); return $this; } @@ -224,7 +225,7 @@ public function redirectMessage($default = null, $delete = true) */ function redirectErrors($default = null) { - $errors = \TypeRocket\Http\ErrorCollection::getFromRuntimeCache(); + $errors = ErrorCollection::getFromRuntimeCache(); return !is_null($errors) ? $errors->errors() : $default; }