Warnings after PHP change

Phoca Gallery - image gallery extension
User avatar
KarEm
Phoca Professional
Phoca Professional
Posts: 154
Joined: 20 Dec 2015, 21:25

Warnings after PHP change

Post by KarEm »

Hello Jan,
I have updated my XAMPP configuration to:
Joomla 3.10.4
PHP 8.0.14
PG is on V 4.4.3

Due to the change to PHP 8.x, two warnings were issued:

Warning: attempting to access an array offset to a value of type int in ...xampp\htdocs\hp_joomla1\administrator\components\com_phocagallery\libraries\phocagallery\imagefront.php on line 402

Deprecated: Required parameter $treeId follows optional parameter $id in ...xampp\htdocs\hp_joomla1\modules\mod_phocagallery_tree\mod_phocagallery_tree.php on line 135

The following change fixed this warning:
function categoryTreePGTM( $data, $tree, $id = 0, $text = '', $treeId) {
change to:
function categoryTreePGTM( $data, $tree, $id = 0, $text = '', $treeId = 0) {

Could you please check if this is ok?

Is there a fix for the first warning? If so, If so, I offer to test it.

Thanks in advance

Regards
KarEm

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Warnings after PHP change

Post by Jan »

Hi, thank you for the info. Because these are warnings, they have in fact low priority (as warnings and notices can be easily disabled in Joomal configuration). I will take a look at it but the advice is just simple. If you run the latest PHP (PHP8) then run even the latest Joomla (Joomla 4) and Phoca Gallery (event it is still Beta).

Phoca Gallery is in Beta version (but in fact this is stable as I don't have an fix in the front):

https://www.phoca.cz/demo/
https://www.phoca.cz/wallpapers/
https://www.phoca.cz/phocacart4demo/phoca-gallery

But back to topic, yes, your fixes are correct. So I will include them in next release.

Thank you, Jan
If you find Phoca extensions useful, please support the project
User avatar
KarEm
Phoca Professional
Phoca Professional
Posts: 154
Joined: 20 Dec 2015, 21:25

Re: Warnings after PHP change

Post by KarEm »

Hi Jan,
thanks for the quick reply and confirmation.
Yes, they are only warnings and I am aware of the disable possibilities.

I want to stay with the active pages on Joomla 3.x for a while and test in parallel J4 and PG4 under PHP 8.x on XAMPP.

If you have a fix, please let me know.

Regards
KarEm
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Warnings after PHP change

Post by Jan »

Hi, just add following code before the line 402:

Code: Select all

if (!is_array($categoryImageOrdering) && is_numeric($categoryImageOrdering)) {
            $categoryImageOrdering = PhocaGalleryOrdering::getOrderingString($categoryImageOrdering);
        }
If you find Phoca extensions useful, please support the project
User avatar
KarEm
Phoca Professional
Phoca Professional
Posts: 154
Joined: 20 Dec 2015, 21:25

Re: Warnings after PHP change

Post by KarEm »

Hi Jan,

done and works as expected.

Great!

Many thanks for this quick fix.

Regards
KarEm
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Warnings after PHP change

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
Post Reply