Skip to content

Commit 16534f6

Browse files
committed
:octocat: ECI: throw on invalid encoding ID
1 parent 3783ef7 commit 16534f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Data/ECI.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function getLengthInBits():int{
6565
* Writes an ECI designator to the bitbuffer
6666
*
6767
* @inheritDoc
68+
* @throws \chillerlan\QRCode\Data\QRCodeDataException
6869
*/
6970
public function write(BitBuffer $bitBuffer, int $versionNumber):QRDataModeInterface{
7071
$bitBuffer->put(self::DATAMODE, 4);
@@ -78,6 +79,9 @@ public function write(BitBuffer $bitBuffer, int $versionNumber):QRDataModeInterf
7879
elseif($this->encoding < 1000000){
7980
$bitBuffer->put(($this->encoding | 0xC00000), 24);
8081
}
82+
else{
83+
throw new QRCodeDataException('invalid ECI ID');
84+
}
8185

8286
return $this;
8387
}

0 commit comments

Comments
 (0)