Scanned docs - 5.0.2

I am working on an upgrade from 4.2 to 5.0.2. Windows server and PHP 7.1 (x64)

When I try to access a scanned doc using the 5.0.2 code from the contributed library, I get an error "ERROR: The following variable contains invalid characters: " both as a display and in the error log. No program or variable is shown.

I thought it might be related to the way the database structure was built because I may have been using the scanned documents code that was earlier than 4.2. I built a fresh, new version of OpenEMR on a different server with PHP 7.3. When I tried to add a scanned document, I got the same error, so the problem doesn’t appear to be related to the older version or database.

Also, the new installation has tons of undefined index and variable notices in the error log

hi @suitable1, could you post an example file name that you’re using? It sounds like you’re hitting this check

also you can eliminate notices by fine tuning your php settings

The error message doesn’t show what file is causing the error. I get the same error when trying to retrieve an existing document or add a new scan to an encounter. It’s the contributed scanned docs set.

I’m seeing the same problem in an upgraded instance or the brand-new install.

BTW - it is scanned_notes, not scanned docs.

@suitable1
From our high level analysis - the root cause of the issue may be due to inclusion of the function check_file_dir_name() in file mentioned below:

File:/interface/forms/scanned_notes/new.php

This has been included in the latest version 5.0.2 in this commit

When the scanned notes form opened for the first time - the form_id will be empty. So this causes the function (check_file_dir_name) to terminate with the following error message:

Error:The following variable contains invalid character

We may need to check this file to avoid the error.

Thank You
ViSolve-120