Bugs with Joomla 4.3.2 and PHP 8.1

Phoca Guestbook - creating guestbooks in Joomla! CMS
dicide
Phoca Member
Phoca Member
Posts: 33
Joined: 19 Jan 2021, 22:38

Bugs with Joomla 4.3.2 and PHP 8.1

Post by dicide »

Hello,

I am despairing. I had to shut down my old website (Joomla 3) 1 week ago and did a new installation on Joomla 4.3.2 with PHP 8.1.
Everything works until now, but unfortunately the Phoca Guestbook extension has serious problems!
(I hope that these errors do not also appear in Phoca Gallery)

So Phoca Guestbook installs correctly and also the language file. Everything works except for one thing:
If you want to delete a post in the frontend, you get this message:

0
count(): Argument #1 ($value) must be of type Countable|array, int given

I found a post in the forum. Because here:
viewtopic.php?t=64717

I also changed everything there with a PHP editor (except for the penultimate entry in the post)

Code: Select all

Post by kleini78 » Jun 06, 2023, 10:13 am

Hello,
many thanks for your help. Now it works great.

I also changed line 556 (components/com_phocaguestbook/models/guestbook.php )
CODE: SELECT ALL

if(!$this->_db->execute()) {
and line 499 ( Components/com_phocaguestbook/Models/Gästebuch.php ).
CODE: SELECT ALL

if ((Int)$cid < 1) {
(to delete an entry)
but the error still appears.
Is it possible that the extension doesn't run smoothly with PHP 8.1?

I hope you understand my rusty English

Best regards
Jens

Tags:
christine
Phoca Hero
Phoca Hero
Posts: 2737
Joined: 28 Nov 2010, 17:20

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by christine »

Hallo Jens,

mal ruhig tief Luft holen :-) It's me christine2 (forum-de)
Wir können deutsch weiter plauschen.

PHP 8.1 > sollte OK sein (für Joomla 4) nicht für Joomla 3.

Frage: Es handelt sich NICHT um eine Migration? Also von J3 Version zu J4?

Gehe daher von einer Neuinstallation aus.
Codeschnitzel oben: Das sind aber nicht alle geänderten Codes - wie im verlinkten Thread.

Beachte auch, den richtigen PHP File zu nehmen.
PHP Editor? Aha. Ich ändere mit Notepad++

Kontrolliere nochmals die Codes vom Jan mit Deinen Einträgen.

Liebe Grüße
Christine
dicide
Phoca Member
Phoca Member
Posts: 33
Joined: 19 Jan 2021, 22:38

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by dicide »

Huhu Christine,

Sie mal an hier wird auch Deutsch geredet :) Das wusste ich nicht ok^^

Eh..... Ja ist eine frische Neu-Installation, die alte ja da waren zuviele alte Plugins Installiert, die jedesmal eine fehlerhafte Migration ausgelöst haben.
Daher habe ich mich entschlossen mir die Mühe zu machen und eine Neuinstallation aufzulegen mit PHP 8.1

Du benutzt Notepad++?
Ok dann werde ich denn mal ausprobieren, ich habe die ganze Zeit immer mit PHPStorm gearbeitet.

Ja dieser Beitrag wo ich gefunden habe verstehe ich nicht so ganz :(
Der vorletzte Eintrag:

Code: Select all

Bereitstellen von kleini78 » 06 Jun 2023, 10:13

Hallo,
vielen Dank für Ihre Hilfe. Jetzt klappt es super.

Ich habe auch die Zeile 556 geändert (Komponenten/com_phocaguestbook/Modelle/Gästebuch.php )
CODE: ALLES AUSWÄHLEN

if(!$this->_db->execute()) {
und Zeile 499 ( Komponenten/com_phocaguestbook/Modelle/Gästebuch.php ) nach
CODE: ALLES AUSWÄHLEN

if ((Int)$cid < 1) {
(zum Löschen eines Eintrags)
Die Zeile 499 da ist bei mir was anderes.

Das wäre schön wenn du mit mir die Einzelnen Schritte durch gehen würdest^^

Ich Installiere erst mal deinen Empfohlenen PHP-Editor

LG
Jens
christine
Phoca Hero
Phoca Hero
Posts: 2737
Joined: 28 Nov 2010, 17:20

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by christine »

Hallo Jens,
dicide wrote: 23 Jun 2023, 18:35
Die Zeile 499 da ist bei mir was anderes.

Das wäre schön wenn du mit mir die Einzelnen Schritte durch gehen würdest^^
weiß ich ja nicht, was Du in Zeile 499 hast.
In dem verlinkten Thread steht:
and line 499 ( components/com_phocaguestbook/models/guestbook.php ) to

Code: Select all

if ((Int)$cid < 1) {
Jan hat eh so schön die Codes plus Zeilen angegeben.

Musst halt aufpassen, dass Du keine Syntax Fehler machst.
Rufst den Notepad++ auf > holst Dir den richtigen (!) File > richtige Zeile > dann demtsprechend abändern.
Codierung UTF8 (ohne BOM).

Liebe Grüße
Christine
dicide
Phoca Member
Phoca Member
Posts: 33
Joined: 19 Jan 2021, 22:38

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by dicide »

Alles klar

Ich probiere es gleich nochmal und gebe dann bescheid
dicide
Phoca Member
Phoca Member
Posts: 33
Joined: 19 Jan 2021, 22:38

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by dicide »

So,

Bei Zeile 499 steht bei mir im Notepad+++ folgendes:

Code: Select all

$whereb[]	= 'b.catid = '.$this->getState('category.id');
Wie soll ich nun in Zeile 499

Code: Select all

if ((Int)$cid < 1) {
einfügen?

Alles andere habe ich nun getauscht (außer Zeile 499)
christine
Phoca Hero
Phoca Hero
Posts: 2737
Joined: 28 Nov 2010, 17:20

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by christine »

Ich muss mir GB runterladen und schauen, was dort in dieser Zeile 499 steht.
dicide
Phoca Member
Phoca Member
Posts: 33
Joined: 19 Jan 2021, 22:38

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by dicide »

Alles klar,

Danke dir :)

Mach dir kein Stress und danke für die Hilfe!
christine
Phoca Hero
Phoca Hero
Posts: 2737
Joined: 28 Nov 2010, 17:20

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by christine »

Stress machen? Nee, den habe ich schon :-)

Folgende Zeilen schreibe ich jetzt direkt hier an Jan & informiere ihn via Mail.

Hallo Jan,

Kann die Angabe vom User von 21:15h bestätigen, da ich PG runtergeladen und angeschaut habe.
Siehe bitte anderen Thread: viewtopic.php?t=64717
wo der User kleini78 angibt, die Zeile 499 geändert zu haben.

Die Zeile 499 zeigt:

Code: Select all

$whereb[]	= 'b.catid = '.$this->getState('category.id');
Kann mir nicht vorstellen, dass das if segment dort ausgetauscht werden soll. Sondern eher an anderer Stelle?
Also wo gehört folgendes wohin?

Code: Select all

if ((Int)$cid < 1) {
Danke
Christine
christine
Phoca Hero
Phoca Hero
Posts: 2737
Joined: 28 Nov 2010, 17:20

Re: Bugs with Joomla 4.3.2 and PHP 8.1

Post by christine »

Hallo Jan & Jens,

Ich glaube, dass der User kleini78 im anderen Thread den falschen File angegeben hat.
Habe verglichen.

Er meinte eventuell Zeile 499 nicht in diesem (von ihm) angegebenen File:
... and line 499 ( components/com_phocaguestbook/models/guestbook.php ) to .....

sondern diesen da: components/com_phocaguestbook/controllers/phocaguestbook.php
dann könnte das vorgeschlagene (geänderte) if statement gemeint sein.

Christine
Post Reply