Просмотр исходного кода

:octocat: QRCode::isByte(): string "0" fails with empty()

smiley 3 лет назад
Родитель
Сommit
de3dd9a480
2 измененных файлов с 2 добавлено и 1 удалено
  1. 1 1
      src/QRCode.php
  2. 1 0
      tests/QRCodeTest.php

+ 1 - 1
src/QRCode.php

@@ -307,7 +307,7 @@ class QRCode{
 	 * a dummy
 	 */
 	public function isByte(string $data):bool{
-		return !empty($data);
+		return $data !== '';
 	}
 
 }

+ 1 - 0
tests/QRCodeTest.php

@@ -74,6 +74,7 @@ class QRCodeTest extends TestCase{
 	public function testIsByte():void{
 		$this::assertTrue($this->qrcode->isByte("\x01\x02\x03"));
 		$this::assertTrue($this->qrcode->isByte('            ')); // not empty!
+		$this::assertTrue($this->qrcode->isByte('0'));
 
 		$this::assertFalse($this->qrcode->isByte(''));
 	}