diff --git a/test/EncoderTest.php b/test/EncoderTest.php new file mode 100644 index 0000000..dfa5100 --- /dev/null +++ b/test/EncoderTest.php @@ -0,0 +1,12 @@ +assertEquals(0x00, \Zhandlersocket\Encoder::encode(null)); + } + function testDecodeNull() + { + $this->assertEquals(null, \Zhandlersocket\Encoder::decode(chr(0x00))); + } +} \ No newline at end of file diff --git a/zhandlersocket/Encoder.zep b/zhandlersocket/Encoder.zep index ba87465..8083445 100644 --- a/zhandlersocket/Encoder.zep +++ b/zhandlersocket/Encoder.zep @@ -34,7 +34,7 @@ class Encoder { } public static function decode(data) -> string|null { - if 0x00 === data { + if 0x00 === ord(data) { return null; }