We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5622063 commit dc93f82Copy full SHA for dc93f82
src/Types/Geometry.php
@@ -51,9 +51,14 @@ public static function getWKTClass($value)
51
52
public static function fromWKB($wkb)
53
{
54
+ // mysql adds 4 NUL bytes at the start of the binary
55
+ $prefix = "\0\0\0\0";
56
+ if (substr($wkb, 0, strlen($prefix)) == $prefix) {
57
+ $wkb = substr($wkb, strlen($prefix));
58
+ }
59
+
60
$parser = new Parser(new Factory());
-// return $parser->parse(ltrim($wkb)); // using ltrim to remove the 4 nul bytes at the start of the string
- return $parser->parse(substr($wkb, 4)); // mysql adds 4 NUL bytes at the start of the binary
61
+ return $parser->parse($wkb);
62
}
63
64
public static function fromWKT($wkt)
0 commit comments