flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

Fix PHP byte validation and reenable builds

Open lsl opened this issue 3 years ago • 0 comments

CI builds for PHP were disabled in https://github.com/google/flatbuffers/pull/6381 and sometime later removed.

This PR fixes the byte validation error and re-introduces the (updated) build.

The byte validation error was caused by attempting to check if:

0 <= "\0" && "\0" <= 255 // false

coming from this line, which evaluates false, instead validating on the ord value for bytes we can compare like for like:

0 <= ord("\0") && ord("\0") <= 255 // true

which allows the value to be treated as a valid, in range, byte.

Test's also needed a couple of fixes to pass but they looked like bugs.

Testing:

cd tests
php phpTest.php
FlatBuffers php test: completed successfully
flatc --php -o php union_vector/union_vector.fbs
php phpUnionVectorTest.php 

lsl avatar Nov 25 '22 12:11 lsl