Bug 234557

Summary: www/gallery2: Update to work with php72
Product: Ports & Packages Reporter: mjl
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Open ---    
Severity: Affects Only Me CC: rene, rpksale1
Priority: --- Keywords: needs-qa
Version: LatestFlags: bugzilla: maintainer-feedback? (sunpoet)
koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Description Flags
fix php syntax not valid in php 7.2
fix php syntax not valid in php 7.2
more php7 patches from https://github.com/gregstoll/gallery2 none

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 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 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 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
Comment 10 Rene Ladan freebsd_committer 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 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 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.