Bug 1214128 - PHP Deprecated: Non-static method fills logs
Summary: PHP Deprecated: Non-static method fills logs
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gallery2
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michael Cronenworth
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-22 05:15 UTC by Joel
Modified: 2017-03-14 02:20 UTC (History)
3 users (show)

Fixed In Version: gallery2-2.3.2-16.fc25
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-13 23:54:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch that silences almost all the messages (54.01 KB, patch)
2015-07-14 03:22 UTC, Joel
no flags Details | Diff
Fix to stringparser (425 bytes, patch)
2015-07-15 16:28 UTC, Joel
no flags Details | Diff
Updated diff. Fixes enough of the warnings that it is unlikely to break logs (75.14 KB, patch)
2015-07-16 16:57 UTC, Joel
no flags Details | Diff
diffs broken out by plugin (15.23 KB, patch)
2015-07-16 17:25 UTC, Joel
no flags Details | Diff
diffs by plugin (15.23 KB, application/x-gzip)
2015-07-16 17:27 UTC, Joel
no flags Details
error_log from entering an album (3.91 KB, text/plain)
2015-07-22 18:13 UTC, David A. De Graaf
no flags Details
error_log fragment - entering an album with new F24 gall*.rpms (30.68 KB, text/plain)
2015-08-04 16:45 UTC, David A. De Graaf
no flags Details
Error msgs from upgrade attempt (2.84 KB, text/plain)
2017-02-25 19:02 UTC, David A. De Graaf
no flags Details
A sample of the patches needed (2.87 KB, patch)
2017-02-26 04:04 UTC, Joel
no flags Details | Diff

Description Joel 2015-04-22 05:15:12 UTC
Description of problem:

gallery2 on fc21 fills  ssl_error_log with PHP Deprecated: Non-static method calls.

[Tue Apr 21 22:05:53.485835 2015] [:error] [pid 5691] [client 157.55.39.211:30669] PHP Deprecated:  Non-static method GalleryDataCache::containsKey() should not be called statically, assuming $this from incompatible context in /usr/share/gallery2/modules/core/classes/Gallery.class on line 922
[Tue Apr 21 22:05:53.485870 2015] [:error] [pid 5691] [client 157.55.39.211:30669] PHP Deprecated:  Non-static method GalleryDataCache::_getCache() should not be called statically, assuming $this from incompatible context in /usr/share/gallery2/modules/core/classes/GalleryDataCache.class on line 203
[Tue Apr 21 22:05:53.499205 2015] [:error] [pid 5691] [client 157.55.39.211:30669] PHP Deprecated:  Non-static method GalleryUtilities::isEmbedded() should not be called statically, assuming $this from incompatible context in /usr/share/gallery2/modules/rewrite/classes/parsers/modrewrite/ModRewriteUrlGenerator.class on line 38
[Tue Apr 21 22:05:53.499230 2015] [:error] [pid 5691] [client 157.55.39.211:30669] PHP Deprecated:  Non-static method GalleryDataCache::containsKey() should not be called statically, assuming $this from incompatible context in /usr/share/gallery2/modules/core/classes/Gallery.class on line 922



And so on... for 100s of gigs.

Comment 1 David A. De Graaf 2015-07-10 14:55:32 UTC
Me too!
While travelling to Europe during June I saw that the root filesystem had zero space left.  Luckily I found the ginormous /var/log/httpd/error_log file, zeroed it, and shut down httpd.
Now home again, I am baffled at the cause.  What went wrong?  How to fix it?

Comment 2 David A. De Graaf 2015-07-11 17:59:27 UTC
The recurring error message in /var/log/httpd/error_log is this:

[Sun Jul 05 21:22:14.821823 2015] [:error] [pid 25042] [client 66.249.64.214:33929] PHP Deprecated:  Non-static method GalleryDataCache::containsKey() should not be called statically, assuming $this from incompatible context in /usr/share/gallery2/modules/core/classes/Gallery.class on line 922

When I count the times this appears in the last five weeks of log files:
    grep Non-static error*  | wc
I get
    28041407 841930128 9059528290

28 million error messages consuming 9 gigabytes of disk space is not acceptable and means I can no longer use gallery2.  I have searched diligently for a fix without result.

Comment 3 Joel 2015-07-14 03:22:26 UTC
Created attachment 1051598 [details]
patch that silences almost all the messages

I did this really quickly.  I tested it on my gallery2.  Will add more later on as they show up in the logs.

Comment 4 Joel 2015-07-14 03:24:48 UTC
This diff was generated on a Fedora 22 system.

You should be able to apply to the base of your tree.  At some point (if the gallery2 owner) doesn't do it, I may create a new src.rpm.  But it will be a long time before I have time.  I can test though.

Comment 5 Joel 2015-07-15 01:43:50 UTC
I have a few more tweaks if anyone is interested.

Comment 6 David A. De Graaf 2015-07-15 15:26:53 UTC
Thank you very much, Joel.  I applied your patch to my Fedora 21 system and most of the error messages have been suppressed.  All except this one:

[Wed Jul 15 10:55:14.074234 2015] [:error] [pid 12887] [client 66.249.67.49:52593] PHP Deprecated:  Non-static method StringParser_Node::destroyNode() should not be called statically, assuming $this from incompatible context in /usr/share/gallery2/lib/bbcode/stringparser.class.php on line 356

I tried to make sense of stringparser.class.php, looking for any similarities with the patches, but couldn't find a way to fix it.  My knowledge of this kind of code is non-existent.  I hope you can find time to fix this one, too.


Incidentally, the patches did not work perfectly on my Fedora 21 system.  This fifth patch to ./gallery2/modules/core/classes/GalleryDataCache.class failed:

@@ -198,9 +198,8 @@
      * Does the cache contain the key specified?
      * @param string $key
      * @return boolean true if the cache contains the key given
-     * @static
      */
-    function containsKey($key) {
+    public static function containsKey($key) {
        $cache =& GalleryDataCache::_getCache();
        if (!$cache['memoryCacheEnabled']) {
            return false;

It failed because the line
-     * @static
was not present in the original code, so could not be removed.  I added it to the code, it was duly removed, and the patch succeeded.

In addition, at the end of the patch application came this line:

Reversed (or previously applied) patch detected!  Assume -R? [n] y

As noted, I chose y and let it go.  Not sure what chaos that caused.

I expect to upgrade this system to Fedora 22 Real Soon Now, and will retain your patch file for use then.

Comment 7 Joel 2015-07-15 16:28:50 UTC
Created attachment 1052395 [details]
Fix to stringparser

silent stringparser complaints

Comment 8 Joel 2015-07-15 16:30:20 UTC
Thanks for the feedback.  My diffs are really sloppy ... was trying to get as much done as quickly as possible.

Here is a diff for stringparser.  Give it a try?

At some point soon I will try to send another update.

Are you getting the mysql vs mysqli warnings?  Which adodb driver are you using?

Comment 9 Joel 2015-07-15 16:31:34 UTC
Also the GalleryView::getItem() fix will be more complicated as this is called both statically and non-statically.  Will do some other time.

Comment 10 Joel 2015-07-16 16:57:23 UTC
Created attachment 1052751 [details]
Updated diff.  Fixes enough of the warnings that it is unlikely to break logs

This patch set obsoletes the previous patches.  Please try!

Comment 11 Joel 2015-07-16 17:25:57 UTC
Created attachment 1052766 [details]
diffs broken out by plugin

File is a tar ball of diffs.

Comment 12 Joel 2015-07-16 17:27:58 UTC
Created attachment 1052767 [details]
diffs by plugin

Comment 13 David A. De Graaf 2015-07-22 18:13:11 UTC
Created attachment 1054971 [details]
error_log from entering an album

Comment 14 David A. De Graaf 2015-07-22 18:14:05 UTC
Joel:
I have now freshly installed Fedora 22, reinstalled the gallery2 database from a mysql backup, and applied your patches from comment 10, gallery2_updated.diff.

The volume of /var/log/httpd/error_log is smaller, but is still too much.  I will attach a portion produced by entering a new album.  The files still producing unwanted messages are:
  /usr/share/gallery2/modules/core/classes/GalleryCoreApi.class      5 times
  /usr/share/gallery2/modules/core/classes/GalleryDerivative.class   4 times
  /usr/share/gallery2/modules/core/classes/helpers/GalleryToolkitHelper_simple.class                                   1 time

Your gallery2_updated.diff includes patches for GalleryCoreApi.class,
but not for GalleryDerivative.class or GalleryToolkitHelper_simple.class.

Could you take a look at these three, please?


On an apparently unrelated topic, the last lines in the attachment say:

[Wed Jul 22 13:28:14.150410 2015] [:error] [pid 19206]
Misconfiguration of certificate's CN and virtual name. The certificate
CN has datium. We expected datium.datix.lan as virtual name.

Apparently I set the machine name as datium during the F22 installation, whereas it had been datium.datix.lan previously (or vice versa).  Certificates are beyond my comprehension, so any advice how to fix this would be welcome.

Comment 15 Joel 2015-07-22 19:35:36 UTC
I have no advice on the certificate issue.  That is something I spelunk into every few years and work through to get resolved.  Plenty of information out there on setting up httpd with the virtual.  You probably just have to gen a new cert.

Regarding the patches, if you look at the diffs, you'll see that it is trivial for you to create them as well --- you don't need to wait for me.  99% of the time it is just adding "public static" to the front of the function name.

Sometime in the next week I'll try to dive in and look again.  I'll fix the ones you list, plus I'll mine my logs for additional ones.

It would be helpful if you wandered around your gallery testing various things including the admin interface and printing and the plugins you use and then uploading the (ssl_)error_log.

Comment 16 Gwyn Ciesla 2015-08-04 14:09:51 UTC
Ok, sorry for the wait.  I built gallery2 with the patches from the tarball.  I had to drop a few sections due to duplication.  Please test.  If it's good, I'll build for everything.

https://fedorapeople.org/~limb/gallery2/

Comment 17 David A. De Graaf 2015-08-04 16:42:19 UTC
I feel like the proverbial bull in a china shop, but I'll try to help...

I used wget to download the 76 new rpms (for F24) of Comment 16 into my F22 system; then did
  dnf update *.rpm
and restarted httpd; entered my gallery2, was surprised NOT to have to reinitialize it.

In /var/log/httpd/error_log there are now, I think, more errors than before.
I have isolated those induced by entering a single album and will attach that fragment for your reading pleasure.  There are 93 lines; the last 3 due to an unrelated certificate misconfiguration problem that remains unresolved.

Clearly the static/non-static problems remain.

I will try to restore the system as it was - Fresh F22, plus patches from comment 10, gallery2_updated.diff.  Hopefully, dnf downgrade will work.

Comment 18 David A. De Graaf 2015-08-04 16:45:31 UTC
Created attachment 1059185 [details]
error_log fragment - entering an album with new F24 gall*.rpms

Comment 19 Fedora End Of Life 2015-11-04 15:25:40 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 20 Jan Kurik 2015-12-02 19:30:11 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 21 Joel 2016-12-11 07:19:48 UTC
Problem still exists in Fedora 25...please apply previously provided patch?

Comment 22 Michael Cronenworth 2017-02-20 17:47:53 UTC
There are a few additional compatibility issues with PHP7 that prevents Gallery2 from working on Fedora 25+.

@Jon, are you still maintaining gallery? Would you like a co-maintainer? I've solved the handful of issues and have it working for my instance and would be happy to build a patched package.

Comment 23 Joel 2017-02-20 17:52:50 UTC
Michael, are you interested in a tester for your .src.rpm?

Comment 24 Gwyn Ciesla 2017-02-21 16:56:01 UTC
@Michael

I've actually drifted away from PHP in the last several years.  If you'd like to take gallery2 (and 3?) I can give them to you.  If not, request ACLs and you can co-maintain.

Comment 25 Michael Cronenworth 2017-02-21 17:25:07 UTC
@Joel, once I get patches made I'll provide a link to a SRPM.

@Jon, I will offer to take gallery2. I still have a gallery2 instance, and while I should look for other software, it is not my top priority. I'll have to pass on gallery3. I don't have any way to test it.

My FAS username: mooninite

Comment 26 Fedora Admin XMLRPC Client 2017-02-21 17:59:25 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 27 Gwyn Ciesla 2017-02-21 17:59:52 UTC
Ownership changed.  Thank you!

Comment 28 David A. De Graaf 2017-02-21 19:13:51 UTC
Michael, I am so happy to see that you are expressing an interest in gallery2.   I have been a (more or less) happy user for many years with over 11,000 pictures.  But, after a new Fedora 25 install, I have been completely unable to run either the install or update scripts.  Tons of error messages; none of use (to me).     I can reprise these events if you're interested.

I'm totally ignorant of coding methods used in web applications, and must rely on "instructions for dummies" to use this stuff, until recently with some success.

While I can offer no help in fixing it, I might be a "useful idiot" in testing it.

Good luck.  There are doubtless many of us out here hoping for a fixed gallery[23].

Incidentally, FWIW, I tried to install gallery3 and went to the "install" page, but was told I was not allowed to enter that page.  That seemed odd for a new fresh installation.  No explanation.  So I gave up.

Comment 29 Michael Cronenworth 2017-02-21 20:48:29 UTC
Thanks, Jon.

I have created a package to test. I've just noticed that the admin interface is broken so that may not work for you. I'll try to investigate that issue later.

https://koji.fedoraproject.org/koji/taskinfo?taskID=17981355

Comment 30 Michael Cronenworth 2017-02-23 19:32:39 UTC
@David @Joel

Have either of you tested the new package yet? I want to push a F25 update soon.

Comment 31 David A. De Graaf 2017-02-24 22:31:46 UTC
I would if I could but I can't.   ;-)
I clicked on the koji link in C29 which led me to a long list of rpms, gallery2-2.3.2-15.fc26, built for rawhide.  (I have gallery2-2.3.2-13.fc24.noarch installed.)  So I looked for them in rawhide:
  # dnf repository-packages "*rawhide*" list available "gallery2*"
  Last metadata expiration check: 1:09:12 ago on Fri Feb 24 16:09:33 2017.
  Error: No matching Packages to list
Evidently there are no gallery2 packages in rawhide.

So how, then, do I test the gallery2-2.3.2-15.fc26 packages?
Must I download individually all ~77 of them?  Or is there a better way?
Sorry to be dense.

Comment 32 Michael Cronenworth 2017-02-24 22:38:22 UTC
Yes, there are a few easy ways to install the update. However, the update won't help much on F24 since it is still using PHP5. My F24 instance was working fine on PHP5, but you should see some of the warnings disappear.

dnf --releasever=rawhide update gallery2*
or
koji download-build 860797

Comment 33 David A. De Graaf 2017-02-25 18:59:56 UTC
I am still unable to get into "upgrade" phase.  I installed your new packages
  dnf --releasever=rawhide update gallery2*
but that failed because the rawhide gpgkey wasn't found.  After scrounging a while, I gave up and did
  dnf --nogpgcheck --releasever=rawhide update gallery2*
which installed the full 76 packages - gallery2-2.3.2-15.fc26.noarch, et al,
on my Fedora 25 system which includes, BTW, php-7.0.16-1.fc25.x86_64, et al.

When I pointed firefox at datix.us/gallery2/upgrade, the welcome page was preceded by a dozen or so error lines.  When I clicked on "Continue to Step 1>>"
I got a "Not Found" error, and I could go no further.

I will attach a file with the full output, cut 'n pasted.

I tried again with Google Chrome, but got the same errors.

Comment 34 David A. De Graaf 2017-02-25 19:02:18 UTC
Created attachment 1257633 [details]
Error msgs from upgrade attempt

Comment 35 Joel 2017-02-26 03:16:41 UTC
Michael,

I tried the RPMs and it doesn't look like my patches in "Updated diff. Fixes enough of the warnings that it is unlikely to break logs"

Have been applied.  Other than upgrade the RPMs kind of work, but you can't run with them because it will fill the logs in a few minutes.

Comment 36 Joel 2017-02-26 03:29:01 UTC
Hmmm.  I think I'm wrong.  These are tons of "PHP Deprecated:" errors whose fix I'm not seeing in my diffs. (although I have a vague memory that I had fixed them a few years ago)

Comment 37 Joel 2017-02-26 04:04:34 UTC
Created attachment 1257763 [details]
A sample of the patches needed

Somehow I screwed up and lost all of these kind of fixes.

Comment 38 Michael Cronenworth 2017-02-26 20:08:38 UTC
Thanks for the additional changes. I'm going to push a F25 update with the additional patch. On my Gallery2 instance I don't see any warnings or errors in the log. I'll have to address the issue regarding the admin page and upgrade pages with a separate update.

Comment 39 Fedora Update System 2017-02-26 20:10:15 UTC
gallery2-2.3.2-16.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d5b689adee

Comment 40 Fedora Update System 2017-02-26 23:19:18 UTC
gallery2-2.3.2-16.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d5b689adee

Comment 41 Fedora Update System 2017-03-13 23:54:24 UTC
gallery2-2.3.2-16.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 42 Fedora Update System 2017-03-14 02:20:44 UTC
gallery2-2.3.2-16.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.