Graphical Pain Map bug

arnabnaha wrote on Monday, February 22, 2016:

Hello All,
While trying to use the Graphical Pain Map for a ptient today, I noticed, it was not loading on the screen. So went to the php error logs to check the issue and found this -

22-Feb-2016 17:00:47 Asia/Kolkata] PHP Fatal error: Call to undefined method Controller::Controller() in C:\xampp\htdocs\openemr\interface\clickmap\C_AbstractClickmap.php on line 47

Can this be fixed please?

Thanks and regards,
Dr. Arnab Naha

fsgl wrote on Monday, February 22, 2016:

Does this work?

arnabnaha wrote on Monday, February 22, 2016:

Thanks fsgl…
I changed the controller() with __construct()
and it worked

arnabnaha wrote on Monday, February 22, 2016:

I am adding it for a code review and a bug fix…

here is the fix -

Please review the code…

fsgl wrote on Monday, February 22, 2016:

Amazing, a fix.

Don’t know the difference between controller() & construct(), even if they ran over me in their respective cars.

bradymiller wrote on Tuesday, February 23, 2016:

Hi Arnab,

Thanks for the fix, which I just brought into the codebase. This bug is related to the PHP7 code conversion. For a class, in PHP4, the standard was to name the constructor method of a class the same name as the class. However, in PHP5 and above, it was recommended to label the function __construct instead; and PHP7 is forcing this. Because of this, we thought we had converted them all, however we had obviously not gotten them all. I also found several more issues in other forms and fixed them.

thanks,
-brady
OpenEMR

bradymiller wrote on Tuesday, February 23, 2016:

Hi fsgl,
One of these days you are going to look in the mirror and realize you are a developer :slight_smile:
-brady

fsgl wrote on Tuesday, February 23, 2016:

Will never be as good as you, El Jefe, when I finally sit down to learn this stuff.