Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

DB escaped quote returned as encoded

Hi,

I have a problem where a string is escaped, but then not converted back. Below is a bit more detail:

class Car extends \Phalcon\Mvc\Model {...}

$c = (new Car())->setName("Bob's car")->save();

That is saved in DB (MariaDB) as "Bob's car". All fine so far, however, when we do:

$name = $c->getName();

Rather than getting "Bob's car", I'm still getting "Bob's car".

What am I doing wrong? What do I have to configure to auto decode the string?

Thanks in advance.



67.7k

probably your html , var_dump ( x debug ) is encoging it

it displays fine with

{{ car.name }}

so I doubt it would be that.



5.0k
Accepted
answer

After checking a lot of things that turned out to be unrelated I have found the culprit.

When assigning that particular value, I've used

$this->request->getPost('name', 'string');

Which passes the value through filter var, whilst annoying, it's not exactly Pahlcon's fault.