4images Forum & Community

4images Help / Hilfe => Bug Fixes & Patches => Topic started by: kp on August 24, 2021, 11:40:54 AM

Title: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: kp on August 24, 2021, 11:40:54 AM
Deutsch siehe weiter unten:
-------------------------------

Because there seems to be no official support anymore I reviewed the code and fixed errors, warnings und deprecated messages for PHP 8.x.
Also errors are fixed wich comes with PHP 7 (SQL backup).
Some functions had to be re-coded because of removed PHP-functions with PHP 8. 
I've tested as much as I could and I couldn't find any error or warning with the new code and it worked for me perfect.
Attached you'll find a zip-file with the changed files. Replace the existing files with them and your gallery should work with PHP 8 and MYSQL.

I spend a lot of time with debugging an find the new code for the needed functions.
 :!: If you think this deserves a bit of respect you could donate me some money to go out with my wife as compensation of my long hours working on that issues ;) So if you want to do so, please donate to  ebay < at > lexow.de

Thank you

-----------------------------------

Da es hier keinen offiziellen Support mehr zu geben scheint (habe auch die Programmieren selbst angeschrieben - ohne Erfolg) habe ich den Code überprüft und die Errors, Warnings und Deprecated Messages von PHP 8.x beseitigt.
Daneben habe ich auch Fehler beseitigt die schon auf PHP 7 nicht mehr funktioniert haben (SQL Backup).
Einige Funktionen musste ich neu/umschreiben da PHP 8 benutzte Funktionen aus den alten Versionen nicht mehr unterstützt.
Ich habe so viel getestet wie möglich um das Script zu prüfen und weitere Fehler zu finden. Stand heute läuft alles einwandfrei bei mir.
Im Anhang findet ihr eine zip-Datei mit den geänderten Dateien. Diese einfach gegen die vorhandenen ersetzen und die Gallery sollte mit PHP 8 und MYSQL funktionieren.

Ich habe viel Zeit mit Debugging und der Suche nach dem neuen Code für die verwendeten Funktionen zugebracht.
 :!: Wenn du denkst, dass verdient etwas Respekt und es dir ein paar Euro wert ist, so würde ich mich über eine kleine Spende freuen mit der ich meine Frau mal zum Essen ausführen kann als Ausgleich für die vielen Arbeitsstunden an den letzten Abenden ;) Wenn dem so ist, dann könnt ihr gerne etwas per Paypal an diese E-Mail-Adresse:  ebay < at > lexow.de   spenden.

Vielen Dank
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: Sunny C. on September 19, 2021, 04:31:38 PM
WOW!
Ich werde das in den nächsten Wochen mal durchtesten und ggf. dazu eine manuelle Umsetzung schreiben.
Danke im Voraus!

LG
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: Sunny C. on October 05, 2021, 04:43:56 PM
Aus der install.php müssen folgende Dinge entfernt werden:

function addslashes_array($array) {
  foreach ($array as $key => $val) {
    $array[$key] = (is_array($val)) ? addslashes_array($val) : addslashes($val);
  }
  return $array;
}

und

if (get_magic_quotes_gpc() == 0) {
  $HTTP_GET_VARS = addslashes_array($HTTP_GET_VARS);
  $HTTP_POST_VARS = addslashes_array($HTTP_POST_VARS);
  $HTTP_COOKIE_VARS = addslashes_array($HTTP_COOKIE_VARS);
}

So klappt auch die Installation.
Nach dem Aufruf ist das ACP als auch das Frontend erreichbar.
Ich nutze zum Test die aktuelle PHP 8.0.11.0

Bisher SUPER!
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: wang5555 on October 22, 2021, 12:35:26 PM

I spend a lot of time with debugging an find the new code for the needed functions.
 :!: If you think this deserves a bit of respect you could donate me some money to go out with my wife as compensation of my long hours working on that issues ;) So if you want to do so, please donate to  ebay < at > lexow.de
Good job. :D
Thank you very much.

But I am not familiar with how to donate via eBay.
I hope you can also provide a link for Paypal donation. :wink:
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: kp on December 16, 2021, 09:03:37 PM

I spend a lot of time with debugging an find the new code for the needed functions.
 :!: If you think this deserves a bit of respect you could donate me some money to go out with my wife as compensation of my long hours working on that issues ;) So if you want to do so, please donate to  ebay < at > lexow.de
Good job. :D
Thank you very much.

But I am not familiar with how to donate via eBay.
I hope you can also provide a link for Paypal donation. :wink:

Hey wang5555,
it's not ebay to donate, it's my email for paypal donations ;)
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: candys on February 25, 2022, 12:52:17 PM
Leider komme ich nach anwendung des php 8 fixes nicht weiter. Ich kriege ständig folgende Fehlermeldung

Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'candys'@'localhost' (using password: YES) in C:\xampp\htdocs\gallery\includes\db_mysqli.php:39 Stack trace:
 #0 C:\xampp\htdocs\gallery\includes\db_mysqli.php(39): mysqli_connect('localhost', 'candys', '12345678')
#1 C:\xampp\htdocs\gallery\install.php(234): Db->__construct('localhost', 'candys', '', 'usr_web209_4') #2 {main} thrown in C:\xampp\htdocs\gallery\includes\db_mysqli.php on line 39

Ich bin absolut ratllos vielleicht hat jemand eine idee.
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: kp on February 25, 2022, 02:32:14 PM
Hallo,
für mich liest sich das nach einem falschen Passwort (oder Usernamen).
Sicher, dass der User existiert und das PW richtig ist?

Dann muss ich fragen, hats du den Fix über eine existierende Version gespielt (so soll es sein) oder installierst du gerade erste das Komplettpaket?
Ansonsten würde sich noch die Frage stellen, wie alt die Passwörter in deiner Datenbank sind, denn der Verschlüsselungsmechanismus wurde vor ein paar Jahren geändert.

Allerdings gibt es mittlerweile auch ein offizielles Update des Pakets für PHP8.

Gruß
KP


Leider komme ich nach anwendung des php 8 fixes nicht weiter. Ich kriege ständig folgende Fehlermeldung

Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'candys'@'localhost' (using password: YES) in C:\xampp\htdocs\gallery\includes\db_mysqli.php:39 Stack trace:
 #0 C:\xampp\htdocs\gallery\includes\db_mysqli.php(39): mysqli_connect('localhost', 'candys', '12345678')
#1 C:\xampp\htdocs\gallery\install.php(234): Db->__construct('localhost', 'candys', '', 'usr_web209_4') #2 {main} thrown in C:\xampp\htdocs\gallery\includes\db_mysqli.php on line 39

Ich bin absolut ratllos vielleicht hat jemand eine idee.
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: candys on February 25, 2022, 05:09:50 PM
Ich versuche das Komplettpaket 1.8 zu installieren.
Das ist über xampp zum testen. auf meinem Webspace krieg ich nach Start der Installation nur das Bild aus dem Anhang.



Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: kp on February 25, 2022, 05:41:09 PM
Die Installationsroutine hatte ich nicht überarbeitet (ggf. oben die Tipps vonqBass17 beachten).

Hier würde ich dir empfehlen die fertige offizielle Version 1.9 zu installieren.


Ich versuche das Komplettpaket 1.8 zu installieren.
Das ist über xampp zum testen. auf meinem Webspace krieg ich nach Start der Installation nur das Bild aus dem Anhang.
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: candys on February 25, 2022, 05:45:07 PM
Ich werde es später mal testen. Danke
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: wflorian on August 11, 2022, 11:30:41 PM
Danke!
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: kitty999 on September 10, 2023, 10:44:11 PM
Hi,

Thanks for taking the time to share this!

It seems to work for the most part except i keep getting warnings:
Warning: Undefined array key "user_level"
Warning: Undefined array key "user_name"
etc.

Any thoughts on how to fix this?
Thanks
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: kp on September 11, 2023, 08:41:12 AM
Hi,

Thanks for taking the time to share this!

It seems to work for the most part except i keep getting warnings:
Warning: Undefined array key "user_level"
Warning: Undefined array key "user_name"
etc.

Any thoughts on how to fix this?
Thanks

On which pages to get this warnings?  (see URL in browser).
Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: kitty999 on September 11, 2023, 08:55:32 PM
It was several pages, but I seem to have fixed it by declaring the varibales blank if not used, for example:
$user_info['user_level'] = isset($user_info['user_level']) ? $user_info['user_level'] : '';
$user_info['user_name'] = isset($user_info['user_name']) ? $user_info['user_name'] : '';
etc.

Everything seems to work fine except I'm not able to login. If I try to login from the admin panel I get this:
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' '', '')' at line 4 in C:\xampp\htdocs\4images\includes\db_mysqli.php:76 Stack trace: #0 C:\xampp\htdocs\4images\includes\db_mysqli.php(76): mysqli_query(Object(mysqli), 'REPLACE INTO 4i...') #1 C:\xampp\htdocs\4images\includes\sessions.php(138): Db->query('REPLACE INTO 4i...') #2 C:\xampp\htdocs\4images\includes\sessions.php(179): Session->start_session('1', 1) #3 C:\xampp\htdocs\4images\admin\admin_global.php(105): Session->login('Frankie', '4rtttyggh5757DD', 0, 0) #4 C:\xampp\htdocs\4images\admin\index.php(6): require('C:\\xampp\\htdocs...') #5 {main} thrown in C:\xampp\htdocs\4images\includes\db_mysqli.php on line 76

Title: Re: PHP 8 - Fix for Image Gallery 1.8 - Ready to use / Fertig zum Anwenden
Post by: kp on September 12, 2023, 11:25:25 AM
I'm quite busy at the moment and can't dive deep in to this problem here.
But as the error mentioned, the SQL Syntax is wrong.
mysqli_query(Object(mysqli), 'REPLACE INTO 4i...')
Is the wrong statement.
I can't see the details after "4i..." there must be something wrong.

Here you can check the syntax:
https://mariadb.com/kb/en/replace/

Btw. here in the case could it be wrong to user_level and user_name to ''. So check if it is really correct

What is happen, when you remove the fix for the variables? It is working then and just the warnings occur?