Bug 234557 - www/gallery2: Update to work with php72
Summary: www/gallery2: Update to work with php72
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2019-01-02 06:10 UTC by mjl
Modified: 2023-05-20 12:26 UTC (History)
6 users (show)

See Also:
koobs: merge-quarterly?


Attachments
fix php syntax not valid in php 7.2 (755 bytes, patch)
2019-01-02 06:10 UTC, mjl
no flags Details | Diff
fix php syntax not valid in php 7.2 (1.55 KB, patch)
2019-01-02 09:25 UTC, mjl
no flags Details | Diff
more php7 patches from https://github.com/gregstoll/gallery2 (109.66 KB, patch)
2020-04-17 23:18 UTC, mjl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mjl 2019-01-02 06:10:16 UTC
Created attachment 200693 [details]
fix php syntax not valid in php 7.2

With the deprecation of php versions less than 7.1, www/gallery2 needs to be updated to work.  The attached patch makes gallery2 work for me.  The error the patch solves is:

[Wed Jan 02 17:47:26.801016 2019] [php7:error] [pid 36662] [client 192.168.3.23:50754] PHP Fatal error:  'break' not in the 'loop' or 'switch' context in /usr/local/www/gallery2/lib/adodb/adodb-time.inc.php on line 1009
Comment 1 mjl 2019-01-02 09:25:35 UTC
Created attachment 200698 [details]
fix php syntax not valid in php 7.2

This revision also fixes the following error

[Wed Jan 02 21:16:13.062114 2019] [php7:error] [pid 38285] [client 192.168.3.23:51340] PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /usr/local/www/gallery2/modules/core/classes/helpers/GalleryEntityHelper_simple.class:79

I found the fix at https://github.com/bobosch/gallery2/commits/master

There are a number of php warnings in httpd-error.log that another project addresses:

https://github.com/gregstoll/gallery2/commits/master

I am wondering what the right way forward to updating the gallery2 port is.
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-01-19 13:32:52 UTC
I plan to commit the fix from bobosch/gallery2 first. After that, we could consider moving to gregstoll/gallery2 since gallery2 upstream is in hibernation.
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-01-19 20:32:11 UTC
A commit references this bug:

Author: sunpoet
Date: Sat Jan 19 20:32:00 UTC 2019
New revision: 490736
URL: https://svnweb.freebsd.org/changeset/ports/490736

Log:
  Fix PHP 7 issue

  - Bump PORTREVISION

  Obtained from:	https://github.com/bobosch/gallery2/commit/4ddfafa416ffe5babd95f2a6532742c3ec903275
  		https://github.com/bobosch/gallery2/commit/4fc50203a12b78217999df00759d70d283efce2f
  PR:		234557
  Submitted by:	Matthew Luckie <mjl@luckie.org.nz>

Changes:
  head/www/gallery2/Makefile
  head/www/gallery2/files/patch-lib-adodb-adodb-time.inc.php
  head/www/gallery2/files/patch-modules-core-classes-GalleryStorage-GalleryStorageExtras.class
Comment 4 mjl 2019-01-20 00:08:46 UTC
Thanks for committing this.  If you leave the bug open I'll send through more patches, as these just stop the fatal errors.  There are lots of warnings in php7 on gallery2.
Comment 5 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-01-24 17:14:26 UTC
(In reply to mjl from comment #4)

I'll try to move to gregstoll/gallery2 this weekend. If so, do you want to submit your patch here or to the new upstream directly?
Comment 6 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-02-05 12:57:59 UTC
I found that gregstoll/gallery2 is based on the gallery2 code, not the release tarball. For example, it does not provide language files (*.po) of the themes.

I may need to add the patches from gregstoll/gallery2 manually instead of changing upstream to it.
Comment 7 rpksale1 2019-04-05 14:26:13 UTC
What must I do to update my Gallery 2 application with these fixes?

I am running a stock G2 installation on Godaddy using PHO 5.6. PHP 7+ is available. 

G2 is currently creating many errors, so much that I had to disable logging (error_log). The log file was 990+ MB in about a month ...

Please provide detailed instructions.
Comment 8 mjl 2020-04-17 23:18:20 UTC
Created attachment 213513 [details]
more php7 patches from https://github.com/gregstoll/gallery2

These are all the patches that are in GitHub that fix php7 warnings in gallery2.
Comment 9 mjl 2020-04-18 00:35:57 UTC
if you commit this patch, can you please remove the modifications to PasswordHelper.class in patch-gregstoll-4d7f661d as the modification introduced a bug: https://github.com/gregstoll/gallery2/issues/13
Comment 10 Rene Ladan freebsd_committer freebsd_triage 2020-12-31 12:25:09 UTC
PHP 7.2 expired today, is this relevant for PHP 7.3 / 7.4 / 8.0 too?
Comment 11 mjl 2020-12-31 18:15:19 UTC
(In reply to Rene Ladan from comment #10)
Yes it is still relevant.  I'd like to see it committed.  Should I condense the patches down into one file?  What's the best way forward?
Comment 12 Rene Ladan freebsd_committer freebsd_triage 2021-01-01 17:23:58 UTC
(In reply to mjl from comment #11)
I think it would be easiest to generate one patch using "svn diff".
Comment 13 Po-Chuan Hsieh freebsd_committer freebsd_triage 2021-01-03 00:15:34 UTC
(In reply to mjl from comment #11)

If you'd like to follow https://github.com/gregstoll/gallery2, please try to generate the .po files. We could simply change upstream to it with proper GH_TAGNAME and no longer need patch files.
Comment 14 Daniel Engberg freebsd_committer freebsd_triage 2021-12-08 19:54:49 UTC
Friendly ping on this one
Comment 15 Daniel Engberg freebsd_committer freebsd_triage 2022-02-12 08:33:20 UTC
Looks like we need to move to https://github.com/hlh-restart/gallery2-1 in order to keep it working? Is there any interest of doing so otherwise it's time to say goodbye to this port.
Comment 16 mjl 2022-02-12 09:55:21 UTC
I will take a look at it, and see if I can get a solution that is commit-able.  I am using gallery2 with the patch I submitted and I would like to see gallery2 remain as a port.
Comment 17 tgvr 2022-05-30 13:33:55 UTC
hello, i am running
Gallery version = 2.3.1 core 1.3.0.1
i have been having issues with php versions, 
i am able to get it running again by getting the hosting to temp downgrade.
is there any way to get it working again ? gallery 3 is too much work to start over.

i tried 
https://github.com/hlh-restart/gallery2-1
that says
-
This is a fork of the now-dormant gallery2 project. The gallery code was written against PHP 5, and there are some changes in PHP 7 that were causing problems for me (as well as a bunch of warnings). I fixed the two bugs I found and cleaned up some of the warnings.

Some more fixes for PHP 8.0.

This code is based on gallery2 version 2.3.2 (core version 1.3.0.2)

FYI - Brad Dutton has revived Gallery 3 that is compatible with PHP 7. I haven't tried it, but you can download it at galleryrevival.com.
-
im not sure if im missing something but i copy the file to the sever. but the installer\upgrade fails with errors like


Deprecated: Non-static method GalleryUtilities::isEmbedded() should not be called statically, assuming $this from incompatible context in:

any advise?
thanks
Comment 18 tgvr 2022-05-31 04:09:43 UTC
(In reply to mjl from comment #16)
hello, which patch are you using?
Comment 19 mjl 2022-05-31 04:14:30 UTC
I am using the patch attached to this bug report:

https://bz-attachments.freebsd.org/attachment.cgi?id=213513

which is derived from gregstoll's github.
Comment 20 tgvr 2022-05-31 11:53:56 UTC
(In reply to mjl from comment #19)
thanks, how does it work? if a click the link its a bunch of txt?
did it fix the php issue for you?
Comment 21 tgvr 2022-06-21 06:11:51 UTC
any newS?
Comment 22 tgvr 2022-07-29 09:21:12 UTC
i guess galley2 is done
Comment 23 Henri Hennebert 2023-05-20 12:26:28 UTC
Hello,

In case it can be useful, I modify gallery2 to be compatible with php 8.1;

see https://github.com/hlh-restart/gallery2-1

Henri