Notifications
Clear all
Topic starter
Posted : January 14, 2022 15:44
It seems that a Decprecated notice has appeared in this plugin, probably due to some update. Lines 140 & 144 of /qrcode/lib/qrencode.php file:
PHP Deprecated: Implicit conversion from float *VARIOUS NUMBERS HERE* to int loses precision.
The old code was:
public function getCode()
{
$ret;
if($this->count < $this->dataLength) {
$row = $this->count % $this->blocks;
$col = $this->count / $this->blocks;
if($col >= $this->rsblocks[0]->dataLength) {
$row += $this->b1;
}
$ret = $this->rsblocks[$row]->data[$col];
} else if($this->count < $this->dataLength + $this->eccLength) {
$row = ($this->count - $this->dataLength) % $this->blocks;
$col = ($this->count - $this->dataLength) / $this->blocks;
$ret = $this->rsblocks[$row]->ecc[$col];
} else {
return 0;
}
$this->count++;
return $ret;
}
}
Â
I have managed to fix this, not 100% sure this is correct but the Notice is gone:
Â
public function getCode()
{
$ret;
if($this->count < $this->dataLength) {
$row = $this->count % $this->blocks;
$col = (int)($this->count / $this->blocks);
if($col >= $this->rsblocks[0]->dataLength) {
$row += $this->b1;
}
$ret = $this->rsblocks[$row]->data[$col];
} else if($this->count < $this->dataLength + $this->eccLength) {
$row = ($this->count - $this->dataLength) % $this->blocks;
$col = (int)(($this->count - $this->dataLength) / $this->blocks);
$ret = $this->rsblocks[$row]->ecc[$col];
} else {
return 0;
}
$this->count++;
return $ret;
}
}
Â
If anyone cares to comment, i would appreciated it.
Posted : December 11, 2023 02:13
Editor reacted
Topic starter
@alessandro-cagliostro What was updated that caused that notice?
Posted : December 11, 2023 02:58
@editor Well this is kinda strange. I only updated Osclasspoint version. PHP is still at 8.0.x, didn't touched that.
So the issue was introduced from Osclasspoint update i guess, not sure why.
Posted : December 11, 2023 03:19
Topic starter
You had an "}" missing at the very end. I added it.
Posted : December 11, 2023 17:10
Alessandro Cagliostro reacted
