Fatal error in opening "Patient document template forms" in newly upgraded 5.0.2(1)

Updating OpenEMR from 5.0.0(7) to 5.0.2 was a challenge since 5.0.2 requires PHP 7.1 and up which was not mentioned in the upgrade wiki. Finally with the help of a post from a user, Paulo Kanda Dec '19 , I was able to successfully install 5.0.2 after XAMPP 7.4.4 install and creating a blank ‘openemr’ database with phpmyadmin. Yea! Thanks Paulo!

During the database upgrade to 5.0.2 with sql_upgrade.php I noticed this error repeating hundreds of times:

“Trying to access array offset on value of type bool in translation.inc.php at line 44”

When the upgrade finished I was excited about the successful upgrade but concerned about the error. When trying to login to localhost/openemr I could not because of that same error regarding “translation.inc.php at line 44” filled in all the login spaces. A search on this forum revealed other users had the same problem logging into a recent upgrade. The solution was to disable error reporting in php.ini per a wiki on “What are the correct PHP settings”.

After disabling error reporting (which I am not entirely comfortable with) I was able to log in OK. After a little testing I put openEMR 5.0.2(1) into production. In further testing and looking at the features of this new version I came across this related error. I am concerned that disabling error reporting in php.ini we are masking the real problem that lies somewhere perhaps still unknown.

The new problem and the reason for this post:

In Patient Documents: Document uploader/viewer, there is a new feature “Patient document template forms”. This will be a very useful feature as a companion to the word processor “Document templates” once it is working. Trying to open one of the stock template forms I get this fatal error:

My question is if errors are disabled according to the PHP settings wiki how will we resolve this error and more importantly what is the source of the error?

Fatal Error:

Trying to access array offset on value of type bool in translation.inc.php at line 44

Original Stack Trace:

#0 C:\xampp\htdocs\openemr\library\translation.inc.php(44): ExceptionThrower::HandleError(8, ‘Trying to acces…’, ‘C:\xampp\htdocs…’, 44, Array)
#1 C:\xampp\htdocs\openemr\library\htmlspecialchars.inc.php(138): xl(‘Patient Templat…’)
#2 C:\xampp\htdocs\openemr\library\htmlspecialchars.inc.php(158): hsc_private_xl_or_warn(‘Patient Templat…’)
#3 C:\xampp\htdocs\openemr\portal\patient\templates\OnsiteDocumentListView.tpl.php(30): xlt(‘Patient Templat…’)
#4 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\savant\Savant3.php(1022): include(‘C:\xampp\htdocs…’)
#5 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\savant\Savant3.php(958): Savant3->fetch(NULL)
#6 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\savant\Savant3.php(944): Savant3->getOutput(‘OnsiteDocumentL…’)
#7 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\verysimple\Phreeze\SavantRenderEngine.php(69): Savant3->display(‘OnsiteDocumentL…’)
#8 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\verysimple\Phreeze\Controller.php(850): SavantRenderEngine->display(‘OnsiteDocumentL…’)
#9 C:\xampp\htdocs\openemr\portal\patient\libs\Controller\OnsiteDocumentController.php(87): Controller->Render()
#10 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\verysimple\Phreeze\Dispatcher.php(169): OnsiteDocumentController->ListView()
#11 C:\xampp\htdocs\openemr\portal\patient\index.php(31): Dispatcher::Dispatch(Object(Phreezer), Object(SavantRenderEngine), ‘’, NULL, Object(GenericRouter))
#12 {main}

In addition to the above error, the default error template could not be displayed:

Trying to access array offset on value of type bool in translation.inc.php at line 44
#0 C:\xampp\htdocs\openemr\library\translation.inc.php(44): ExceptionThrower::HandleError(8, ‘Trying to acces…’, ‘C:\xampp\htdocs…’, 44, Array)
#1 C:\xampp\htdocs\openemr\library\htmlspecialchars.inc.php(138): xl(‘Patient Portal’)
#2 C:\xampp\htdocs\openemr\library\htmlspecialchars.inc.php(158): hsc_private_xl_or_warn(‘Patient Portal’)
#3 C:\xampp\htdocs\openemr\portal\patient\templates\DefaultErrorFatal.tpl.php(9): xlt(‘Patient Portal’)
#4 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\savant\Savant3.php(1022): include(‘C:\xampp\htdocs…’)
#5 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\savant\Savant3.php(958): Savant3->fetch(NULL)
#6 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\savant\Savant3.php(944): Savant3->getOutput(‘DefaultErrorFat…’)
#7 C:\xampp\htdocs\openemr\portal\patient\fwk\libs\verysimple\Phreeze\SavantRenderEngine.php(69): Savant3->display(‘DefaultErrorFat…’)
#8 C:\xampp\htdocs\openemr\portal\patient\index.php(55): SavantRenderEngine->display(‘DefaultErrorFat…’)
#9 {main}

@Joel,

Give the www-data data access to your document directory then you will be able to access all your document from the OpenEMR.

Thanks,
Nilesh

Thank you for responding Nilesh, I forgot to mention that my install is on Windows 10 and accessed locally. I am not familiar with the www-data path. Where do I find that?

-Joel

Hi @Joel,

Give the permission for read,write and execute for document directory.

Thanks,
Nilesh

Nilesh,

I am not sure which directory needs permissions. I checked \openemr\sites\default\document\ and that has read/write/execute permissions granted in the properties security tab for all users. All the document templates are in that \documents\doctemplates subdirectory. That folder also has adequate permissions.

I can access document templates in the “Document uploader/viewer” but not the document template forms. I get the error " Trying to access array offset on value of type bool in translation.inc.php at line 44" when I attempt to open a “Patient document template form”. These template forms are a new feature in 5.0.2 that were not part of 5.0.0 as far as I remember.

The Documents module is also enabled within openemr modules tab, if that is related.

Thanks for trying to help me understand what to do here.
-Joel

Hi @Joel,

Then I do not know what exact issue is might need to look into your OpenEMR.

Thanks,
Nilesh

Hi Joel ,
Have you copied the forms from openemr/contrib/forms/ to openemr/interface/forms/ then go to administration forms and register the database then you can use the forms in clinical tab in an encounter .

1 Like

hi @Joel, you should redo the upgrade process. When you upgrade correctly you will not see any warnings displayed.

Thanks for the tip Richard, I have not done much with those forms because most of them don’t pertain to our speech therapy clinic. I will try registering a few to see if it makes a difference…

The registered forms do show up in the encounter, misc tab, but doesnt affect the Patient Document Template forms nor the line 44 error there when I try to open one of the 3 canned template forms.

-Joel

Stephen,

What exactly is the correct upgrade process for 5.0.2 on Windows 10?

I installed 4.0 several years ago with Brady Millers wonderful dual openEMR/XAMPP file and did all upgrades since then with the same. Thanks Brady! The wiki process to upgrade from 5.0.1 to 5.0.2 has not yet been blessed with the dual update (https://www.open-emr.org/wiki/index.php/Windows_Upgrade_5.0.1_to_5.0.2) and results in an error because a PHP update is needed. I got it to work after finding Paulo Kanda’s post on creating a new database with myphpadmin.

What do you have in mind for a correct install? I have done my process twice on 2 different machines with the same result.

I should say though that we are in production and the therapists are using openemr. They have just a couple minor complaints that I might ask about in a future post including performance issues, the inability of datatype textarea to expand vertically in LBFs, and the scrunched fields in the Fee Sheet.

I want to make reports and form distribution and acquistion easier for them so I am putting some work and hope into document templates and document template forms.

Thanks for all the help!
-Joel

Hi @Joel, you discovered the correct upgrade process :slight_smile:
Think you may have found a bug with your php version.

Are your users in need of translation or is English fine?

If ok with English you could try inserting this before this line

$GLOBALS['skip_english_translation'] = true;

Thank you Stephen! That did the trick. We don’t need translation so we should be good. I’m excited to learn how to make Patient Document Forms!
Do you think it’s OK to continue with PHP 7.4.4 or should I uninstall and go with a recommended PHP ver? It seems like everything is working well. 5.0.2(1) is a little slower than 5.0.0(7) in opening opening patient tabs, switching between clinical and billing view, pretty much slower everywhere. Don’t know if it could be the components in XAMPP 7.4.4 or what.

-Joel

hi @Joel , should be fine, might be wrong about the php version and it might be just a bug

see here for some windows mysql optimization for innodb