Coder Social home page Coder Social logo

Comments (4)

DamienHarper avatar DamienHarper commented on May 25, 2024

Thanks @SanderVerkuil for the report and the test. I'll try to make fix shortly.

from auditor.

DamienHarper avatar DamienHarper commented on May 25, 2024

Well your PR already fixes the issue, thanks πŸ‘πŸ½
When reading this issue I thought it only contains a failing test πŸ˜…
Anyway, it's merged now.

from auditor.

DamienHarper avatar DamienHarper commented on May 25, 2024

I also replied to your question about blob field handling in the PR conversation

from auditor.

SanderVerkuil avatar SanderVerkuil commented on May 25, 2024

I thought fixing it would be a bit more difficult, but the fix was quite simple as it was the same as the binary column type.

The question is more generic though, like, currently when the value is a resource, the diff will show resource#<resource-id>, which is fine if the data is indeed a binary file (or a blob) containing multiple megabytes of data. However, in some cases, the actual value is a couple of bytes, for instance when the blob type is used because the column contains unstructured data, like only 1 or 0, or a float/numeric value.

A possibility for this would be to do something like:

$stream = $value;
stream_rewind($stream);
$possibleValue= stream_get_contents($stream);
if (strlen($possibleValue) > (32 * 1024)) {
  $convertedValue = get_resource_type($value).'#'.get_resource_id($value);
} else {
  $convertedValue = $possibleValue;
}

though this is very inefficiΓ«nt because if the binary or blob data was in fact 2GiB of data, the whole file would be read into memory.

So, due to how Doctrine works, and how I mostly use these values, when I call setData('test data'), the new field will be 'test data', because it is not a string. So in that case the auditor will specify that the new data will be 'test data', and the old field will be <resource_type>#<resource_id>. Or am I seeing this differently?

from auditor.

Related Issues (20)

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.