mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 12:07:32 +00:00
:octocat: correct treatment of VERSION_AUTO
This commit is contained in:
@@ -246,7 +246,9 @@ trait QROptionsTrait{
|
||||
$this->clampRGBValues();
|
||||
}
|
||||
|
||||
$this->version = max(1, min(40, (int)$this->version));
|
||||
if($this->version !== QRCode::VERSION_AUTO){
|
||||
$this->version = max(1, min(40, (int)$this->version));
|
||||
}
|
||||
|
||||
// clamp min/max version number
|
||||
$min = max(1, min(40, (int)$this->versionMin));
|
||||
|
||||
@@ -26,6 +26,7 @@ class QROptionsTest extends TestCase{
|
||||
$this->assertSame(40, (new QROptions(['version' => 42]))->version);
|
||||
$this->assertSame(1, (new QROptions(['version' => -42]))->version);
|
||||
$this->assertSame(21, (new QROptions(['version' => 21]))->version);
|
||||
$this->assertSame(QRCode::VERSION_AUTO, (new QROptions(['version' => QRCode::VERSION_AUTO]))->version); // -1
|
||||
}
|
||||
|
||||
public function testVersionMinMaxClamp(){
|
||||
|
||||
Reference in New Issue
Block a user