R
R
Roma Antonyuk2017-09-19 17:36:28
Yii
Roma Antonyuk, 2017-09-19 17:36:28

What characters can break encoding in json?

There is api for yii2. In the afterSave() method

$record = [
            'reservationId' => $this->id,
            'reservationStatus' => $this->getModeTitle(),
            'message' => $message,
            'emailedGuest' => $emailSent,
            'userId' => $userId,
            'user' => $fullName,
            'type' => $type ? $type : 0,
        ];
        if ($paymentId) {
            $record['paymentId'] = $paymentId;
        }
        if (isset($subject)) {
            $record['subject'] = $subject;
            $record['body'] = $body;
        }
        Yii::info($record, System::LOG_BOOKING);

The problem is that sometimes laman json is stored in the field.
Saves like this
{"reservationId":1981,"reservationStatus":"Balance Receipted","message":"New SMS received from guest","emailedGuest":true,"userId":1,"user":"System Service","type":0,"subject":"SMS","body":"That's great. Thx u. So I could wrk while on holiday
.
Where to look? What could be the problem? Thanks in advance
PS field type "text"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question