PHP 8 and Phoca Gallwery

Phoca Gallery - image gallery extension
King Louis
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 07 Jun 2021, 11:25

PHP 8 and Phoca Gallwery

Post by King Louis »

Good Evening

First of all please take my apologies if this question has already be posted earlier. I couldn't find a search function for the forum.

Here is my question:

I found that after switching PHP from 7.4 to 8.0.3 the List of categories (category view) didn't work anymore. Switching back to 7.4 it works. My settings: J! 3.9.27, Phoca Gallery 4.3.10.

So I'm wondering whether Phoca Gallery is ready for PHP 8? Even as the requirements are: PHP 4, 5 (or any later version)

Thanks for your help and
kind regards

King Louis
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PHP 8 and Phoca Gallwery

Post by Jan »

Hi, testing on PHP8, I don't get any problem there.

Try to enable PHP error reporting so you get possible PHP error which can say more. :idea:

https://www.phoca.cz/documents/16-jooml ... rs-on-site

Jan
If you find Phoca extensions useful, please support the project
King Louis
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 07 Jun 2021, 11:25

Re: PHP 8 and Phoca Gallwery

Post by King Louis »

Hi Jan

Thanks for your fast reply.

I have checked as advised and found the following two messages. Does this give you a clue?

Messages:

1. On my error 404 page: 0 Unsupported operand types: int / string
2. in the error.log :
[Tue Jun 08 09:44:22.463478 2021] [php:notice] [pid 5232:tid 1844] [client 127.0.0.1:54173] PHP Deprecated: Required parameter $currentId follows optional parameter $id in X:\\local_server\\xampp\\htdocs\\test\\components\\com_phocagallery\\models\\categories.php on line 158, referer: http://localhost/test/archiv

on line 158 of categories.php the following function is listet:

function _categoryTree( $data, $tree, $id = 0, $text='', $currentId) {

foreach ($data as $key) {
$show_text = $text . $key->title;

static $iCT = 0;// All displayed items

if ($key->parent_id == $id && $currentId != $id && $currentId != $key->id ) {

$tree[$iCT] = new JObject();
$tree[$iCT]->id = $key->id;
$tree[$iCT]->title = $show_text;
$tree[$iCT]->title_self = $key->title;
$tree[$iCT]->parent_id = $key->parent_id;
$tree[$iCT]->image_id = $key->image_id;
$tree[$iCT]->name = $key->name;
$tree[$iCT]->alias = $key->alias;
$tree[$iCT]->image = $key->image;
$tree[$iCT]->section = $key->section;
$tree[$iCT]->image_position = $key->image_position;
$tree[$iCT]->description = $key->description;
$tree[$iCT]->published = $key->published;
$tree[$iCT]->editor = $key->editor;
$tree[$iCT]->ordering = $key->ordering;
$tree[$iCT]->access = $key->access;
$tree[$iCT]->count = $key->count;
$tree[$iCT]->params = $key->params;
$tree[$iCT]->catid = $key->catid;
$tree[$iCT]->numlinks = $key->numlinks;
$tree[$iCT]->slug = $key->slug;
$tree[$iCT]->hits = $key->hits;
$tree[$iCT]->username = $key->username;
$tree[$iCT]->ratingaverage = $key->ratingaverage;
$tree[$iCT]->ratingcount = $key->ratingcount;
$tree[$iCT]->accessuserid = $key->accessuserid;
$tree[$iCT]->uploaduserid = $key->uploaduserid;
$tree[$iCT]->deleteuserid = $key->deleteuserid;
$tree[$iCT]->userfolder = $key->userfolder;
$tree[$iCT]->latitude = $key->latitude;
$tree[$iCT]->longitude = $key->longitude;
$tree[$iCT]->zoom = $key->zoom;
$tree[$iCT]->geotitle = $key->geotitle;
$tree[$iCT]->avatar = $key->avatar;
$tree[$iCT]->avatarapproved = $key->avatarapproved;
$tree[$iCT]->avatarpublished = $key->avatarpublished;
$tree[$iCT]->link = '';
$tree[$iCT]->filename = '';// Will be added in View (after items will be reduced)
$tree[$iCT]->extid = $key->extid;// Picasa Album or Facebook Album
$tree[$iCT]->extfbcatid = $key->extfbcatid;
// info about one image (not using recursive function)
$tree[$iCT]->filename = $key->filename;
$tree[$iCT]->extm = $key->extm;
$tree[$iCT]->exts = $key->exts;
$tree[$iCT]->extw = $key->extw;
$tree[$iCT]->exth = $key->exth;
$tree[$iCT]->date = $key->date;

$tree[$iCT]->linkthumbnailpath = '';
$iCT++;

$tree = $this->_categoryTree($data, $tree, $key->id, $show_text . " » ", $currentId );
}
}

return($tree);
}
}


Kind regards
King Louis
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PHP 8 and Phoca Gallwery

Post by Jan »

Hi,

2. Just change from:

Code: Select all

function _categoryTree( $data, $tree, $id = 0, $text='', $currentId) { 
to:

Code: Select all

function _categoryTree( $data, $tree, $id = 0, $text='', $currentId = 0) {
This will be changed in next version

1. Do you get some more detailed error message?

Jan
If you find Phoca extensions useful, please support the project
King Louis
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 07 Jun 2021, 11:25

Re: PHP 8 and Phoca Gallery

Post by King Louis »

Hi Jan

Thanks for your input.

2. Solved with your input

1. I've got no more information about errors except the infromation from my 404 page: 0 Unsupported operand types: int / string

I've got no entries in my apache error.log and php_error_log.
And only the apache access log gives:
127.0.0.1 - - [09/Jun/2021:10:15:12 +0200] "GET /test/photos HTTP/1.1" 500 5927 "http://localhost/test/archiv" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0"

Status Code 500 : unexpected server error is given in xammp as well as online only with php 8

However, as I can still run my site unter PHP 7.4 without problems, I will keep this for the moment.

So as this is a "local" problem (and can be worked around) and there is any obvious point, I can live with it.

Many thanks for your help and input.

Kind regards
King Louis
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PHP 8 and Phoca Gallwery

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47794
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: PHP 8 and Phoca Gallwery

Post by Jan »

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