mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-10-08 21:05:50 +00:00
🔧 estimated bit length was correct, add a safety margin instead
This commit is contained in:
+4
-4
@@ -164,9 +164,9 @@ final class QRData{
|
||||
|
||||
// it seems that in some cases the estimated total length is not 100% accurate,
|
||||
// so we substract 4 bits from the total when not in mixed mode
|
||||
# if(count($this->dataSegments) <= 1){
|
||||
# $length -= 4;
|
||||
# }
|
||||
if(count($this->dataSegments) <= 1){
|
||||
$length -= 4;
|
||||
}
|
||||
|
||||
// we've got a match!
|
||||
// or let's see if there's a higher version number available
|
||||
@@ -194,7 +194,7 @@ final class QRData{
|
||||
|
||||
// guess the version number within the given range
|
||||
for($version = $this->options->versionMin; $version <= $this->options->versionMax; $version++){
|
||||
if($total <= $this->maxBitsForEcc[$version]){
|
||||
if($total <= ($this->maxBitsForEcc[$version] - 4)){
|
||||
return new Version($version);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user