Eye Form not loading. Possible PHP 7.1 issue

OpenEMR 5.0.1-dev
Xampp - PHP 7.1.4 - Windows

Eye form is not loading - not even trying. Possible issue with PHP 7.1? Here are two corresponding Apache error log entries:

  • PHP Warning: Illegal string offset ‘marital_status’ in D:\xampp\htdocs\openemr\interface\forms\eye_mag\php\eye_mag_functions.php on line 1681, referer: http://192.168.1.2/openemr/interface/main/tabs/main.php

  • PHP Fatal error: Uncaught Error: Cannot use string offset as an array in D:\xampp\htdocs\openemr\interface\forms\eye_mag\php\eye_mag_functions.php:1681\nStack trace:\n#0 D:\xampp\htdocs\openemr\interface\forms\eye_mag\report.php(443): build_PMSFH(‘1’)\n#1 D:\xampp\htdocs\openemr\interface\forms\eye_mag\report.php(167): narrative(‘1’, ‘4’, 2, ‘3’, ‘narrative’)\n#2 D:\xampp\htdocs\openemr\interface\patient_file\encounter\forms.php(704): eye_mag_report(‘1’, ‘4’, 2, ‘3’)\n#3 {main}\n thrown in D:\xampp\htdocs\openemr\interface\forms\eye_mag\php\eye_mag_functions.php on line 1681, referer: http://192.168.1.2/openemr/interface/patient_file/encounter/encounter_top.php

I just fired up a Windows xampp version 5.0.0 which has PHP 5.6.20, and cannot replicate this error.
Apparently PHP 7.1 has been a problem with this error in particular. Use 7.0 and it will disappear. I will continue to look into this however as the PHP maintainers are unlikely to change their code to suit our needs :wink:

This error is occurring in the building of the PMSFH super-variable. Marital status is pulled into this variable on line 1681. The error suggests $PMSFH[‘SOCH’][‘marital_status’] is defined somewhere earlier as a string, making $PMSFH[‘SOCH’][‘marital_status’][‘short_title’] "illegal’.

Have you created another form using this $PMSFH construct? I asked Brady if there was anything new in the -dev branch that might have touched this code. Using the 5.0.0 release, I cannot see anywhere in the code where any element at this level of the array is defined as a string, $PMSFH[‘SOCH’][‘marital_status’] or any of its siblings. They should not be in fact. Yet they must be… Please advise that this error is limited to PHP 7.1 and that this is a vanilla install of the -dev tip. Curious also if you can install the current release 5.0.0 version on PHP 7.1 and not get this error…

Just changed to XAMPP with php 7.1 and can confirm the error. Suggest downgrading PHP to 7.0 or less for now and this error disappears until we can ensure it works on 7.1

Thank you for your time!