Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.0k views
in Plugins by

Why these errors appear in the file error_log
My site works on version 1.8
php 7

  • PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; qa_googlecse has a deprecated constructor in /home/public_html/qa-plugin/google-cse/qa-google-cse.php on line 24
  • PHP Notice:  Undefined index: up in /home/public_html/qa-include/util/sort.php on line 57
Q2A version: 1.8

1 Answer

+2 votes
by
selected by
 
Best answer

Regarding the deprecated constructor you can fix that by opening file qa-plugin/google-cse/qa-google-cse.php. That file has a class name on top. There will be a function (most likely on line 24) that will have the same class name. You have to change the name of the function so that it becomes __constructor (note there are 2 underscores).

For example, if the class looks like this:

class qa_googlecse {
  public qa_googlecse() {
    ...
  }
}

You have to change it into

class qa_googlecse {
  public function __constructor() {
    ...
  }
}

Regarding the second issue it doesn't seem to be a bug in the core. A plugin must be messing things up or you made a core hack that broke something. You could try removing the core hacks and plugins one by one and see which one is the one to blame.

by
I'd also suggest, if this is from a third party plugin, that you report the issue to the developer (e.g. via their Github repo).
by
yes i made a core hack
http://www.question2answer.org/qa/62239

Is there any solution
by
Can you confirm that if you remove that core hack the notice is also gone?
by
Yes, the error only appears if you visit the modified page
by
I've applied that hack and I do not get any error or notice
by
Is this notification causing a problem or clicking on the server or I can ignore it
by
The notification is the result of the problem. Without knowing the problem itself, it is impossible to know its impact
by
The error ends if you delete

Line 57 in  qa-include / util / sort.php

if ($ a [$ sortkey] == $ b [$ sortkey])

There is a problem deleting it
by
That would be equivalent to fixing a flat tire by removing it :) Remove all core hacks by replacing all files from the official release. If that doesn't fix it the it is a theme or plugin. Go one by one removing it until the notice is fixed
...