From 0af0cd83382bbb70fa2f033fdc96ad8a4b3888d0 Mon Sep 17 00:00:00 2001 From: Koen Eelen Date: Fri, 14 Aug 2020 11:41:52 +0200 Subject: [PATCH 1/3] BUGFIX substr() broke when passing a NULL because of strict type in case mb mod not installed --- src/Monolog/Utils.php | 2 +- test.php | 0 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 test.php diff --git a/src/Monolog/Utils.php b/src/Monolog/Utils.php index 007ad686..7515eadb 100644 --- a/src/Monolog/Utils.php +++ b/src/Monolog/Utils.php @@ -31,7 +31,7 @@ final class Utils return mb_strcut($string, $start, $length); } - return substr($string, $start, $length); + return substr($string, $start, $length ?: strlen($string)); } /** diff --git a/test.php b/test.php new file mode 100644 index 00000000..e69de29b From 515621a0bb1d3cab214b577b1766585eb2a6ccbe Mon Sep 17 00:00:00 2001 From: Koen Eelen Date: Fri, 14 Aug 2020 19:53:15 +0200 Subject: [PATCH 2/3] Delete test.php --- test.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test.php diff --git a/test.php b/test.php deleted file mode 100644 index e69de29b..00000000 From fad3e427c78266abf428c76b11e50ee9f537fb7f Mon Sep 17 00:00:00 2001 From: Koen Eelen Date: Tue, 18 Aug 2020 16:32:06 +0200 Subject: [PATCH 3/3] Made the check in substr() strict compare to NULL --- src/Monolog/Utils.php | 2 +- test.php | 0 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 test.php diff --git a/src/Monolog/Utils.php b/src/Monolog/Utils.php index 7515eadb..5299d441 100644 --- a/src/Monolog/Utils.php +++ b/src/Monolog/Utils.php @@ -31,7 +31,7 @@ final class Utils return mb_strcut($string, $start, $length); } - return substr($string, $start, $length ?: strlen($string)); + return substr($string, $start, (null === $length) ? strlen($string) : $length); } /** diff --git a/test.php b/test.php deleted file mode 100644 index e69de29b..00000000