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: Sunpoet Po-Chuan Hsieh
Keywords: needs-qa
Depends on:
Reported: 2019-01-02 06:10 UTC by mjl
Modified: 2020-04-18 00:35 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)
koobs: merge-quarterly?

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] 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] 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:


I am wondering what the right way forward to updating the gallery2 port is.
Comment 2 Sunpoet Po-Chuan Hsieh freebsd_committer 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 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

  Fix PHP 7 issue


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

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 Sunpoet Po-Chuan Hsieh freebsd_committer 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 Sunpoet Po-Chuan Hsieh freebsd_committer 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