From f7ab09422495a3119b5de5ff3b9efa384d60d373 Mon Sep 17 00:00:00 2001 From: Jamiel <20553479+jamielsharief@users.noreply.github.com> Date: Thu, 30 Jul 2020 14:51:42 +0200 Subject: [PATCH] Fixed boolean validating string as bool --- CHANGELOG.md | 6 ++++++ src/Validation.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe91e91..86c9afd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [unreleased] + +### Fixed + +- Fixed boolean validating string as bool + ## [1.2.0] - 2020-07-30 ## Added diff --git a/src/Validation.php b/src/Validation.php index f719236..81be3e7 100644 --- a/src/Validation.php +++ b/src/Validation.php @@ -120,7 +120,7 @@ public static function before($value, string $beforeDate = 'now'): bool */ public static function boolean($value, array $values = [true, false, 0, 1, '0', '1']): bool { - return ($value !== null && in_array($value, $values)); + return ($value !== null && in_array($value, $values, true)); } /**