Code Monkey home page Code Monkey logo

Comments (6)

cjmellor avatar cjmellor commented on June 30, 2024

@gerb-ster I can't recall but was this related to the #46 ?

from approval.

gerb-ster avatar gerb-ster commented on June 30, 2024

No, this is something else I'm afraid.

It has to do with this line:

['new_data', '=', json_encode($model->getDirtyAttributes())],

The function json_encode is called to json encode the dirty attributes. But if one of those attributes is of the type 'array' it gets double json encoded.

After approval the new_data is converted back to an array on this line:

$model->forceFill($builder->getModel()->new_data->toArray());

and that way you will end up with a json string instead of an array.

I'll open an bugfix-branche and add a test to expose this issue.

from approval.

gerb-ster avatar gerb-ster commented on June 30, 2024

I've added a test which shows the issue

https://github.com/gerb-ster/approval/tree/bugfix_array-attributes

from approval.

cjmellor avatar cjmellor commented on June 30, 2024

Hmm,

I had a quick glance as I had some time. I thought it might be to do with the fact that I am casting new_data and original_data in the Approval model already, as well as encoding it elsewhere, so thought that might be why it is double encoding, but that doesn't seem to be the case as the test still fails 🤔

I can't seem to spot a solution just yet, so if you're able to help out further that'd be great as it does seem like something that could be an issue later, I just haven't had the time lately to focus on Open Source stuff.

Thanks!

from approval.

gerb-ster avatar gerb-ster commented on June 30, 2024

@cjmellor Sure, I'll have a look later today!

from approval.

cjmellor avatar cjmellor commented on June 30, 2024

Closed by #47

from approval.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.