# Missing index and unquoted service patch

**URL:** <https://community.open-emr.org/t/missing-index-and-unquoted-service-patch/6376>\
**Category:** OpenEMR Development\
**Created:** [April 7, 2013, 9:56am UTC](https://community.open-emr.org/t/missing-index-and-unquoted-service-patch/6376 "2013-04-07T09:56:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [April 7, 2013, 9:56am UTC](https://community.open-emr.org/t/missing-index-and-unquoted-service-patch/6376/1 "2013-04-07T09:56:02Z")

</div>

**[apmuthu](https://sourceforge.net/u/apmuthu/)** wrote on [Sunday, April 07, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/86874514/#792a):

The problem:

```auto
PHP Notice: Use of undefined constant background_shutdown - assumed 'background_shutdown' in /var/www/openemr/library/ajax/execute_background_services.php on line 164, referer: http://openemr.example.com/interface/main/left_nav.php
Undefined index: background_force in /var/www/openemr/library/ajax/execute_background_services.php on line 108, referer: http://openemr.example.com/interface/main/left_nav.php

```

The fix:

```auto
--- old/var/www/openemr/library/ajax/execute_background_services.php	Tue Apr 02 02:47:00 2013
+++ new/var/www/openemr/library/ajax/execute_background_services.php	Sun Apr 07 12:29:28 2013
@@ -105,7 +105,8 @@
 
   $single_service = (isset($_GET['background_service']) ? $_GET['background_service'] : 
 	(isset($_POST['background_service']) ? $_POST['background_service'] : ''));
- $force = ($_GET['background_force'] || $_POST['background_force']);
+ $force = (isset($_GET['background_force']) ? $_GET['background_force'] : 
+	(isset($_POST['background_force']) ? $_POST['background_force'] : ''));
 
   $sql = 'SELECT * FROM background_services WHERE ' . ($force ? '1' : 'execute_interval > 0');
   if ($single_service!="")
@@ -161,7 +162,7 @@
   }
 }
 
-register_shutdown_function(background_shutdown);
+register_shutdown_function('background_shutdown');
 execute_background_service_calls();
 unset($service_name);
 

```

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [April 7, 2013, 12:22pm UTC](https://community.open-emr.org/t/missing-index-and-unquoted-service-patch/6376/2 "2013-04-07T12:22:43Z")

</div>

**[yehster](https://sourceforge.net/u/yehster/)** wrote on [Sunday, April 07, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/86874514/#8c68):

> <https://github.com/yehster/openemr/commit/2d1e28cf974dc894641263a364033c850b213e31>

  
It is cleaner to use “$\_REQUEST” instead of trying to check for both “$\_GET” and “$\_POST”

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [April 8, 2013, 3:24am UTC](https://community.open-emr.org/t/missing-index-and-unquoted-service-patch/6376/3 "2013-04-08T03:24:53Z")

</div>

**[apmuthu](https://sourceforge.net/u/apmuthu/)** wrote on [Monday, April 08, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/86874514/#a723):

It’s now committed in the mainline branch:

> <https://github.com/openemr/openemr/commit/2d1e28cf974dc894641263a364033c850b213e31>

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [April 8, 2013, 4:29am UTC](https://community.open-emr.org/t/missing-index-and-unquoted-service-patch/6376/4 "2013-04-08T04:29:07Z")

</div>

**[bradymiller](https://sourceforge.net/u/bradymiller/)** wrote on [Monday, April 08, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/86874514/#d689):

Hi Ap Muthu,

Thank you for posting this fix. For the future, if possible, try to use git/github for code submissions. Here’s a tutorial (and we are all happy to help with any questions along the way):  
[http://www.open-emr.org/wiki/index.php/Git\_for\_dummies](http://www.open-emr.org/wiki/index.php/Git_for_dummies)

-brady  
[OpenEMR](http://www.open-emr.org/)

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [April 8, 2013, 9:22am UTC](https://community.open-emr.org/t/missing-index-and-unquoted-service-patch/6376/5 "2013-04-08T09:22:48Z")

</div>

**[apmuthu](https://sourceforge.net/u/apmuthu/)** wrote on [Monday, April 08, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/86874514/#22d8):

Must I fork it to get submissions in or do I get to directly put in the main GitHub (dangerous) repo?

From the link above:

Let the developers know to review your code by posting an item in the ‘Code Review’ OpenEMR tracker on sourceforge and posting a message in the sourceforge OpenEMR developer forum (simply provide a link to your published github branch along with a quick explanation of your code).

This is where it gets ‘sticky’ …

---

<div class="post-metadata">

**Author:** ![system](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/2X/b/bb9e4e8ae2ea7faac2e952fd9e38a3ce03aac403.png) [@system](https://community.open-emr.org/u/system)\
**Post date:** [April 9, 2013, 7:03am UTC](https://community.open-emr.org/t/missing-index-and-unquoted-service-patch/6376/6 "2013-04-09T07:03:04Z")

</div>

**[bradymiller](https://sourceforge.net/u/bradymiller/)** wrote on [Tuesday, April 09, 2013](https://sourceforge.net/p/openemr/discussion/202506/thread/86874514/#12fd):

Hi,

All you need to do is post a link on the forums (or the tracker). Then it will get reviewed on github. And when it’s ready to go to the official codebase, then one of the code integrators (myself, Kevin, Rod or Tony) will actually commit it to the codebase on sourceforge (note this codebase gets mirrored to github (and several other git repo sites) every 30 minutes.

For more details on how the repos work, check this out:  
[http://www.open-emr.org/wiki/index.php/Repository\_work\_flow\_structure](http://www.open-emr.org/wiki/index.php/Repository_work_flow_structure)

-brady  
[OpenEMR](http://www.open-emr.org/)
