Git Product home page Git Product logo

Comments (7)

ramsey avatar ramsey commented on June 2, 2024

Before I try to troubleshoot this, what is "sgbd?" I assume it's a database engine, but my search isn't turning up any good leads. Thanks!

from uuid.

e-belair avatar e-belair commented on June 2, 2024

Ho, I'm sorry, I used this French acronym by reflex lol, but yeah it means database engine.

from uuid.

ramsey avatar ramsey commented on June 2, 2024

Which database engine are you using? Can you provide more details about how you're storing the serialized value? You might need to change the type of column or collation.

from uuid.

e-belair avatar e-belair commented on June 2, 2024

I'm using Firebird database. The database uuid are binary uuid by default. The field that stores serialized data is a blob subtype 1 (text blob) as you can get a description here and the default character set is UTF-8. I store a serialized entity in that field, the entity contains some uuids and some of them can't be unserialized. The last error I got was the binary string length was 15 when it should be 16. This database field is used in the app to store temporary data that aims to be moderated by a user. So instead of looking for how to resolve Firebird/PHP issues (that I know there is no support everywhere in the universe for Firebird), maybe the best to do imo could be to configure Uuid to serialize uuid as string by default.

from uuid.

e-belair avatar e-belair commented on June 2, 2024

I'm getting a database error in production when serializing uuid

Statement could not be executed (HY000 - -104 - Malformed string )

With an older version of the library, uuids were serialized as string so the customer could load properly the form, but when he tries to save, the new serialization process serialize as bytes and raise the error above.

from uuid.

e-belair avatar e-belair commented on June 2, 2024

I wonder if I could use LazyUuidFromString by default in the app ...

from uuid.

e-belair avatar e-belair commented on June 2, 2024

Finally I've made a patch to force conversion of Uuid to LazyUuidFromString to ensure serialization:

    protected function checkForLazyUuid(mixed $object): void
    {
        if (is_object($object)) {
            $ref = new ReflectionClass($object);
            $props = $ref->getProperties();
            foreach ($props as $prop) {
                $prop->setAccessible(true);
                $value = $prop->getValue($object);
                if ($value instanceof Uuid) {
                    $prop->setValue($object, new LazyUuidFromString($value->toString()));
                } else {
                    $this->checkForLazyUuid($value);
                }
            }
            return;
        }
        if (is_array($object)) {
            array_walk($object, fn ($v) => $this->checkForLazyUuid($v));
        }
    }

from uuid.

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.