giandonatoinverso / PHP-Dynamic-Qr-code

PHP Dynamic Qr code is a script that allows the generation and saving of dynamic and static QR codes
MIT License
260 stars 76 forks source link

Fatal error when you want to insert a new QR-Code in PHP V8.0.12 #9

Closed RALFISBORN closed 2 years ago

RALFISBORN commented 2 years ago

Hello, When I try to add a new dynamic or static QR code, the following error message appears under PHP version 8. Under version 7.X it works perfectly:

Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in C:\xampp_new\htdocs\qr-dynamic\qrcode\lib\MysqliDb\MysqliDb.php:1848 Stack trace: #0 C:\xampp_new\htdocs\qr-dynamic\qrcode\lib\MysqliDb\MysqliDb.php(1848): implode(Array, ', ') #1 C:\xampp_new\htdocs\qr-dynamic\qrcode\lib\MysqliDb\MysqliDb.php(1572): MysqliDb->_buildInsertQuery(Array) #2 C:\xampp_new\htdocs\qr-dynamic\qrcode\lib\MysqliDb\MysqliDb.php(1533): MysqliDb->_buildQuery(NULL, Array) #3 C:\xampp_new\htdocs\qr-dynamic\qrcode\lib\MysqliDb\MysqliDb.php(820): MysqliDb->_buildInsert('dynamic_qrcodes', Array, 'INSERT') #4 C:\xampp_new\htdocs\qr-dynamic\qrcode\lib\Dynamic_Qrcode\Dynamic_Qrcode.php(127): MysqliDb->insert('dynamic_qrcodes', Array) #5 C:\xampp_new\htdocs\qr-dynamic\qrcode\add_dynamic.php(22): Dynamic_Qrcode->add() #6 {main} thrown in C:\xampp_new\htdocs\qr-dynamic\qrcode\lib\MysqliDb\MysqliDb.php on line 1848

giandonatoinverso commented 2 years ago

Thanks for the tip. This script was designed for PHP7, also this error refers to the library which acts as a wrapper between php and db ie MysqlDB. It is an open source library which is also on github.

If you want to use PHP8 you should look for an update of this library, the method names should be the same but the source code should be compatible with PHP8.

RALFISBORN commented 2 years ago

Thanks for the feedback and the tip. I just saw that the error is caused in the MysqliDb.php file with version 2.9.2 and now downloaded the latest 2.9.3 from http://github.com/joshcam/PHP-MySQLi-Database-Class and replaced it. However, the error remains. Do you change the script at some point to the V8 version or does it stop at V7?

giandonatoinverso commented 2 years ago

If I had time I would like to create a new branch with a 2.0 version maybe in PHP8 and with ajax