Comments (7)
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.
Ho, I'm sorry, I used this French acronym by reflex lol, but yeah it means database engine.
from uuid.
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.
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.
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.
I wonder if I could use LazyUuidFromString by default in the app ...
from uuid.
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)
- Misused Psalm Assertion for isValid() method? HOT 8
- Could not find branch v5.x-dev anymore HOT 5
- Bad tag for 4.7.2 ? HOT 2
- ramsey/collection dependency requires PHP 8.1. HOT 2
- Ramsey\Uuid\Nonstandard namespace conflicts with itself in standalone builds HOT 2
- Unserialize error with OrderedTimeCodec HOT 2
- Remove the deleted tag in packagist.org HOT 3
- Deprecated: Return type of Ramsey\Uuid\Uuid::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): HOT 5
- Bump Bump brick/math from ^0.10 to ^0.11 HOT 2
- Mariadb 10.7+ uuid v7 sort HOT 1
- Interface 'Ramsey\Uuid\Provider\TimeProviderInterface' not found HOT 1
- Uuid v7 collisions HOT 9
- Deprecated Implements of Serializable in UuidInterface HOT 1
- Use a PSR clock for internal time management?
- Update brick/math to support v0.12.0
- Inconsistent results between fromString and isValid methods. HOT 2
- Uuid v7 generated in wrong order HOT 3
- Why doesn't this library use `hrtime()` for monotonicity? HOT 1
- Where is uuid7 method ?? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uuid.