From 56208ed86eddc5d85d8f6c00835642fd5bfba8d1 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 22 May 2018 13:36:06 -0700 Subject: [PATCH] Fixed #2913 --- CHANGELOG-v3.md | 5 +++++ src/fields/Number.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-v3.md b/CHANGELOG-v3.md index 0c1ea6b33a0..33157981ffb 100644 --- a/CHANGELOG-v3.md +++ b/CHANGELOG-v3.md @@ -1,5 +1,10 @@ # Release Notes for Craft CMS 3.x +## Unreleased + +### Fixed +- Fixed a PHP error that could occur when `craft\fields\Number::normalizeValue()` was called without passing an `$element` argument. ([#2913](https://github.com/craftcms/cms/issues/2913)) + ## 3.0.9 - 2018-05-22 ### Added diff --git a/src/fields/Number.php b/src/fields/Number.php index dee4a7dd9d4..16b8c323b9f 100644 --- a/src/fields/Number.php +++ b/src/fields/Number.php @@ -149,7 +149,7 @@ public function normalizeValue($value, ElementInterface $element = null) $value = Localization::normalizeNumber($value['value'], $value['locale']); } - return $this->isValueEmpty($value, $element) ? null : $value; + return $value === '' ? null : $value; } /**