Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Why these errors appear in the file error_log

+1 vote
asked Mar 10 in Plugins by islam afify

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
answered Mar 10 by pupi1985
selected Mar 10 by islam afify
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.

commented 5 days ago by islam afify
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
commented 5 days ago by pupi1985
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