Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

fixing invalid UTF8 replacament for php 5.4, 5.5 #1057

Merged
merged 6 commits into from
Mar 5, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup + additional cast to string during validation
cm-jan committed Mar 5, 2014

Verified

This commit was signed with the committer’s verified signature.
lemunozm Luis Enrique Muñoz Martín
commit 0f08e4dec550814e2a8327ce58bca3d10a40abb1
4 changes: 2 additions & 2 deletions library/CM/Form/Abstract.php
Original file line number Diff line number Diff line change
@@ -140,13 +140,13 @@ public function process(array $data, $actionName, CM_Response_View_Form $respons

$formData = array();
foreach ($action->getFieldList() as $fieldName => $required) {
$field = $this->getField($fieldName);
$field = (string)$this->getField($fieldName);
$formData[$fieldName] = null;

$isEmpty = true;
if (array_key_exists($fieldName, $data)) {
// get rid of broken UTF chars
$fieldValue = mb_convert_encoding($data[$fieldName], 'UTF-8', 'UTF-8'); // assuming always string
$fieldValue = mb_convert_encoding($data[$fieldName], 'UTF-8', 'UTF-8');

if (!$field->isEmpty($fieldValue)) {
$isEmpty = false;
2 changes: 0 additions & 2 deletions library/CM/FormField/Text.php
Original file line number Diff line number Diff line change
@@ -14,8 +14,6 @@ public function __construct($lengthMin = null, $lengthMax = null, $forbidBadword
}

public function validate($userInput, CM_Response_Abstract $response) {


if (isset($this->_options['lengthMax']) && mb_strlen($userInput) > $this->_options['lengthMax']) {
throw new CM_Exception_FormFieldValidation('Too long');
}