[FIX] ZM 1.24.2: Delete group undefined index warning

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

[FIX] ZM 1.24.2: Delete group undefined index warning

Post by mastertheknife »

How to reproduce:
Try to create a new group, and right after mark it and then click on "Delete" to delete the group. The group will be deleted, but this error\warning shows up:
Notice: Undefined index: zmGroup in /var/www/zoneminder/htdocs/includes/actions.php on line 1523

Although no functionality is broken and its just a warning generated by php, here is a fix for those interested.

In file includes/actions.php, edit the following, which starts at line 1519 (May vary from installation to installation)
Change it from:

Code: Select all

			if ( !empty($_REQUEST['gid']) )
			{
				dbQuery( "delete from Groups where Id = '".dbEscape($_REQUEST['gid'])."'" );
				if ( $_REQUEST['gid'] == $_COOKIE['zmGroup'] )
				{
					unset( $_COOKIE['zmGroup'] );
					setcookie( "zmGroup", "", time()-3600*24*2 );
					$refreshParent = true;
				}
			}
To:

Code: Select all

			if ( !empty($_REQUEST['gid']) )
			{
				dbQuery( "delete from Groups where Id = '".dbEscape($_REQUEST['gid'])."'" );
				if(isset($_COOKIE['zmGroup'])) {
					if ( $_REQUEST['gid'] == $_COOKIE['zmGroup'] )
					{
						unset( $_COOKIE['zmGroup'] );
						setcookie( "zmGroup", "", time()-3600*24*2 );
						$refreshParent = true;
					}
				}
			}
mastertheknife.
Post Reply