Apache2 error log, php warning (solved)

I’m running open emr v7 patch 2 on ubuntu 22.04 server with mariadb sql server.

I get a lot (1000’s per day) of the following 2 warnings in the apache2 error log.

[Mon Feb 20 13:18:04.065607 2023] [php:warn] [pid 100741] [client] PHP Warning:  Trying to access array offset on value of type bool in /var/www/html/openemr/library/forms.inc on line 162, referer:
[Mon Feb 20 13:18:04.065622 2023] [php:warn] [pid 100741] [client] PHP Warning:  Undefined array key 1 in /var/www/html/openemr/library/forms.inc on line 163, referer:

The code in forms.inc is

function hasFormPermission($formDir)
    // get the aco spec from registry table
    $formRow = sqlQuery("SELECT aco_spec FROM registry WHERE directory = ?", array($formDir));
    $permission = explode('|', $formRow['aco_spec']);
    return AclMain::aclCheckCore($permission[0], $permission[1]);

With line 162 and 163 being the last two lines before the closing curly brace.

I check the registry data table it only has 23 rows in it. Each “aco_spec” field has two words separated by the pipe character.

Possibly the query isn’t returning any results?

Maybe the query is looking for a “directory” that doesn’t exist? How would I tell exactly what that query is asking for in the variables?


Hi D C bearzillasquatch

I think $formRow variable return empty array so its return undefined index error.Can you Check whether your passed directory its correct or not.

If you want to fix this issue change code like this.

function hasFormPermission($formDir)
// get the aco spec from registry table
$formRow = sqlQuery(“SELECT aco_spec FROM registry WHERE directory = ?”, array($formDir));
$permission = explode(’|’, $formRow[‘aco_spec’]);
return AclMain::aclCheckCore(isset($permission[0])?$permission[0]:’’, isset($permission[1])?$permission[1]:’’);



@Param_CapMinds thanks for the help. I’m definitely going to change the code so it checks if it’s set. I’ll also investigate what directory is being passed. It might be a good idea to know if I’m missing something that should be there.


OpenEMR 7.0.1(1) running on Ubuntu 22.04, Php8.1 apache2 error log entry attached

Looking to fix the runaway apache2 error log entries.
When I found this thread, I tried the fix as posted but, it did not work and got this;

[Thu Oct 05 12:53:17.776366 2023] [php:error] [pid 616650] [client] PHP Fatal error: Uncaught Error: Undefined constant "\xe2\x80\x99\xe2\x80\x99" in /var/www/html/openemr/library/forms.inc.php:164\nStack trace:\n#0 /var/www/html/openemr/interface/patient_file/history/encounters.php(583): hasFormPermission()\n#1 {main}\n thrown in /var/www/html/openemr/library/forms.inc.php on line 164, referer:
What am I missing?

That’s a really weird error. It almost looks like you are copying in some bad unicode characters. Check your quote characters as those are common copy problems. You could try manually typing in the lines of code that is on line 164 (the place where the unicode error is triggering) and see if that solves the problem.

1 Like