Undefined Properties, Undefined Offsets, Missing Arguments, Undefined Indexes, and Undefined Variables in PHP Error Log

tylamb19 wrote on Wednesday, March 18, 2015:

When opening a patient’s info, I get all info except for anything under the Appointments menu. Below appointments, all that shows up is the loading spinner (ajax-spinner.gif) and it goes forever. Looking in the console, I see a 500 Internal Server Error on stats.php. A quick look into the server logs reveals a few disturbing things. Could any of these have caused the 500 error on stats.php?

[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Warning: Missing argument 3 for optionalAge(), called in /Library/Server/Web/Data/Sites/openemr/library/options.inc.php on line 1665 and defined in /Library/Server/Web/Data/Sites/openemr/library/options.inc.php on line 57, referer: https://emr./interface/main/finder/dynamic_finder.php
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Warning: Missing argument 3 for optionalAge(), called in /Library/Server/Web/Data/Sites/openemr/library/options.inc.php on line 1665 and defined in /Library/Server/Web/Data/Sites/openemr/library/options.inc.php on line 57, referer: https://emr./interface/main/finder/dynamic_finder.php
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined variable: numcols in /Library/Server/Web/Data/Sites/openemr/interface/patient_file/summary/demographics.php on line 1016, referer: https://emr./interface/main/finder/dynamic_finder.php
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Trying to get property of non-object in /Library/Server/Web/Data/Sites/openemr/library/classes/ORDataObject.class.php on line 125, referer: https://emr./interface/main/finder/dynamic_finder.php
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined offset: 0 in /Library/Server/Web/Data/Sites/openemr/library/classes/Document.class.php on line 127, referer: https://emr./interface/main/finder/dynamic_finder.php
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined property: CategoryTree::$root_type in /Library/Server/Web/Data/Sites/openemr/library/classes/Tree.class.php on line 54, referer: https://emr./interface/patient_file/summary/demographics.php?set_pid=2
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined index: encrypted in /Library/Server/Web/Data/Sites/openemr/controllers/C_Document.class.php on line 389, referer: https://emr./interface/patient_file/summary/demographics.php?set_pid=2
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined index: passphrase in /Library/Server/Web/Data/Sites/openemr/controllers/C_Document.class.php on line 390, referer: https://emr./interface/patient_file/summary/demographics.php?set_pid=2
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Trying to get property of non-object in /Library/Server/Web/Data/Sites/openemr/library/classes/ORDataObject.class.php on line 125, referer: https://emr./interface/patient_file/summary/demographics.php?set_pid=2
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined offset: 0 in /Library/Server/Web/Data/Sites/openemr/library/classes/Document.class.php on line 127, referer: https://emr./interface/patient_file/summary/demographics.php?set_pid=2
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined property: Document::$storagemethod in /Library/Server/Web/Data/Sites/openemr/library/classes/Document.class.php on line 406, referer: https://emr./interface/patient_file/summary/demographics.php?set_pid=2
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined property: Document::$couch_docid in /Library/Server/Web/Data/Sites/openemr/library/classes/Document.class.php on line 414, referer: https://emr./interface/patient_file/summary/demographics.php?set_pid=2
[Tue Mar 17 21:13:06 2015] [error] [client <client’s IP>] PHP Notice: Undefined property: Document::$couch_revid in /Library/Server/Web/Data/Sites/openemr/library/classes/Document.class.php on line 422, referer: https://emr./interface/patient_file/summary/demographics.php?set_pid=2"

I am using OS X Server 10.9.5 and the OpenEMR install worked just fine this morning and in the past, but now doesn’t. What could be the problem and how can I fix it?

Thanks for any help you can give!

fsgl wrote on Wednesday, March 18, 2015:

In general notices can be ignored, provided that there are no fatal errors in error log.

The throbber (spinner) may be a sign to increase capacity.

Try these changes in the php.ini file.

Enable line numbering in the text editor because php.ini is a big file, if not done so already.

tylamb19 wrote on Wednesday, March 18, 2015:

Ok. I made the changes and restarted Apache and I still just get the spinner. Firefox console shows a POST HTTP/1.0 500 Internal Server Error still. I have attached a screenshot of what I can see in a patient window along with the console and “Inspect Network Request” window with the 500 error open.

fsgl wrote on Wednesday, March 18, 2015:

Immediately after recreating the problem, what shows up in the php error log?

Apparently the 500 Internal Server Error message is non-specific, so we need more information.

What versions of OpenEMR & Php are you on?

tylamb19 wrote on Thursday, March 19, 2015:

I know that it’s a little strange, but it started working all of a sudden! I don’t know what the problem really was but it’s working for now. I will update if the problem happens again.

fsgl wrote on Thursday, March 19, 2015:

Whenever a new feature is added to Firefox, the browser needs to be restarted. Likewise with each Windows/Chromebook Update, the device needs rebooting. Perhaps this is the reason the php.ini changes did not take effect immediately, while the user was still logged in the OS X server.

Online articles suggest that the source of the 500 error attributable to max_execution_time or memory_limit as two of the many possible causes. Due to the lack of specificity of this error message, it is a veritable debugging challenge.

Hopefully with the increases we won’t see a recurrence.

tylamb19 wrote on Friday, March 20, 2015:

Well, it’s back. It seems to be something with prescriptions. With “displayErrors = On” I can get the stats to load, but everything except for prescriptions works. The “none” text doesn’t show up (just an empty, small, blue box below the name), pressing the edit and add button does nothing but display a white screen in the right box, and the list button does the same thing. Opening the console in Firefox reveals no errors. When I click on the list or add button, the console reflects an “HTTP 1.1/200 OK” on controller.php, but nothing ever shows up. With displayErrors = Off, I just get the 500 Error in the console. This is obviously OK, so what could be the problem? Disabling prescriptions causes no problems, even with displayErrors = Off.

fsgl wrote on Friday, March 20, 2015:

With display_errors = off, we need the following:

  1. Screenshot with the missing parts of Patient Summary.
  2. Fatal errors from php error log. White screens should have fatal errors logged.
  3. Versions of OpenEMR & Php.

tylamb19 wrote on Friday, March 20, 2015:

With “display_errors = Off” the screenshot is the same as before… Spinner spins forever. With “display_errors = On” I can get stats to load but not prescriptions. I attached a screenshot of this. I do not have any fatal errors, only warnings and notices relating to the “optionalAge() argument missing” issue that we had before. Details on the server & version are as follows:

OpenEMR: 4.2.0
Server: Apache/2.2.26 (Unix)
PHP/5.4.30 mod_fastcgi/2.4.6 mod_ssl/2.2.26 OpenSSL/0.9.8zc

Could it be a problem with the MySQL database?

tylamb19 wrote on Friday, March 20, 2015:

I have figured it out… The RXList.class.php file was corrupt and not letting the stats.php look up any prescriptions. All fixed!