QR Code Free Plugin...
 
Notifications
Clear all

QR Code Free Plugin for Osclass 5.x

5 Posts
2 Users
2 Reactions
310 Views
Editor
(@editor)
Posts: 553
Honorable Member Admin
Topic starter
 

QR Code Plugin for Osclass 5.x (Mindstellar release)

https://github.com/navjottomer/qrcode

This topic was modified 1 year ago by madminz
 
Posted : January 14, 2022 15:44
Alessandro Cagliostro
(@alessandro-cagliostro)
Posts: 212
Reputable Member
 

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
Editor
(@editor)
Posts: 553
Honorable Member Admin
Topic starter
 

@alessandro-cagliostro What was updated that caused that notice?

 
Posted : December 11, 2023 02:58
Alessandro Cagliostro
(@alessandro-cagliostro)
Posts: 212
Reputable Member
 

@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
Editor
(@editor)
Posts: 553
Honorable Member Admin
Topic starter
 

You had an "}" missing at the very end. I added it.

 
Posted : December 11, 2023 17:10