I ran into a problem while developing the CDR module. The module heavily uses header(“Location…”) to redirect the browser around the UI. I was getting a lot of white screens because of it. Looking at the php error log, I figured out that the problem was rooted in the way we use php tags… Throughout openemr, there are an abundance of spaces, which get outputted to the browser before the “headers” are actually sent, which causes errors, and prevents the redirection. Aron also created a bunch of these when he added his copyright notice. Also, a general rule of thumb is to leave off the last end php tag in a php file, which helps avoid this problem. To fix this, I enabled output buffering, which is a workaround for this problem “with the overhead of all of your output to the browser being buffered in the server until you send it.” Anyways, that being said, we should add this setting to the required php.ini settings upon release of the CDR module (at least until we have time to track down and remove the spaces):
I have had Output Buffering enabled on several servers due to it’s being required for the mobile portal to work, haven’t seen any negative consequences from it yet. I suppose it might be worth looking into reworking the code in the mobile portal so it’s not required.
Ken I’d like to see some sample code that demonstrates your navigation methods and the problem you’re having. It may not be so hard to clean up the code as needed without requiring a kludge.
By the way make sure restoreSession() is being called on the client side prior to web server requests.
Example usage of the redirection here:
interface/super/rules/controllers/edit/controller.php
in the function:
_action_submit_summary()
To reproduce the bug, navigate to administrator->rules. Click “add new.” On the next screen, click “cancel” and the redirection code above will yield a white screen.
hi,
Recommend making it work without requiring the setting of output_buffering. Sounds like a place to start is removing the blank lines after the comment blocks.
-brady
I will ask Aron about the best place to put a call to restoreSession(). With the MVC in place, it may only need to be called in one place to affect every script.