From 1aa01a1f6776b2df11b04a6c669c2e2e63c50715 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Thu, 1 Sep 2016 21:07:27 +0200 Subject: [PATCH] [Bridge] Fix invalid text value without pattern --- lib/Bridge.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Bridge.php b/lib/Bridge.php index 84202d5..8f0c356 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -143,8 +143,8 @@ abstract class BridgeAbstract implements BridgeInterface { return $this->items; } - protected function isValidTextValue($value, $pattern){ - if(isset($pattern)){ + protected function isValidTextValue($value, $pattern = null){ + if(!is_null($pattern)){ $filteredValue = filter_var($value, FILTER_VALIDATE_REGEXP, array('options' => array( 'regexp' => '/^' . $pattern . '$/' @@ -221,7 +221,11 @@ abstract class BridgeAbstract implements BridgeInterface { break; default: case 'text': - $data[$name] = $this->isValidTextValue($value, $set[$name]['pattern']); + if(isset($set[$name]['pattern'])){ + $data[$name] = $this->isValidTextValue($value, $set[$name]['pattern']); + } else { + $data[$name] = $this->isValidTextValue($value); + } break; }