Skip to content

Commit

Permalink
Handle empty field data (#8)
Browse files Browse the repository at this point in the history
* Handle empty data 	a7423d6
* Fix whitespace 	38d320e
Signed-off-by: Nils Hörrmann <nils.hoerrmann@hananils.de>
* Version 2.7.1 37baf98
Signed-off-by: Nils Hörrmann <nils.hoerrmann@hananils.de>
  • Loading branch information
nilshoerrmann authored and nitriques committed Aug 10, 2017
1 parent e282645 commit 1fc5131
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion extension.meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
</author>
</authors>
<releases>
<release version="2.7.1" date="2017-08-10" min="2.6.0" max="2.x.x">
- Catch empty field data (prevents empty database rows)
</release>
<release version="2.7.0" date="2017-05-18" min="2.6.0" max="2.x.x">
- Give option to make handle unique or not (default to unique as was before)
- Make sure all entries table always have a UNIQUE KEY on the `entry_id` column
Expand Down Expand Up @@ -119,4 +122,4 @@
- This is a complete rewrite of the old extension, it isn't backwards compatible, so don't try to upgrade.
</release>
</releases>
</extension>
</extension>
7 changes: 6 additions & 1 deletion fields/field.textbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,11 @@ public function checkPostFieldData($data, &$message, $entry_id = null) {

public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null) {
$status = self::__OK__;

if (strlen(trim($data)) == 0) {
return array();
}

$formatted = $this->applyFormatting($data);

$result = array(
Expand Down Expand Up @@ -810,7 +815,7 @@ private static function replaceAnds($data) {
if (!preg_match('/((\W)and)|(and(\W))/i', $data)) {
return $data;
}

// Negative match?
if (preg_match('/^not(\W)/i', $data)) {
$mode = '-';
Expand Down

0 comments on commit 1fc5131

Please sign in to comment.