Jump to content



Issue Information

  • #000550

  • 0 - None Assigned

  • New

  • 2.3.2

  • -

Issue Confirmations

  • Yes (0)No (0)
Photo

E_NOTICE in all osC versions (navigation_history.php)_

Posted by dr_lucas on 06 December 2012 - 06:04 PM

Issue:
File includes/classes/navigation_history.php  Error Type: [E_NOTICE] Undefined index: get File includes/classes/navigation_history.php  Error Type: [E_NOTICE] Undefined index: post


Proposed Fix:
CHANGE:

function set_snapshot($page = '') {
	  global $PHP_SELF, $HTTP_GET_VARS, $HTTP_POST_VARS, $request_type;

	  if (is_array($page)) {
		$this->snapshot = array('page' => $page['page'],
								'mode' => $page['mode'],
								'get' => $this->filter_parameters($page['get']),
								'post' => $this->filter_parameters($page['post']));
	  } else {
		$this->snapshot = array('page' => basename($PHP_SELF),
								'mode' => $request_type,
								'get' => $this->filter_parameters($HTTP_GET_VARS),
								'post' => $this->filter_parameters($HTTP_POST_VARS));
	  }
	}

To:

function set_snapshot($page = '') {
	  global $PHP_SELF, $HTTP_GET_VARS, $HTTP_POST_VARS, $request_type;

	  if (is_array($page)) {
		$this->snapshot = array('page' => $page['page'],
								'mode' => $page['mode'],
								'get' => (isset( $this->filter_parameters($page['get'])) ? $this->filter_parameters($page['get']) : ''),
								'post' => (isset($this->filter_parameters($page['post'])) ? $this->filter_parameters($page['post']) : ''));
	  } else {
		$this->snapshot = array('page' => basename($PHP_SELF),
								'mode' => $request_type,
								'get' => (isset($this->filter_parameters($HTTP_GET_VARS)) ? $this->filter_parameters($HTTP_GET_VARS) : ''),
								'post' => (isset($this->filter_parameters($HTTP_GET_VARS)) ? $this->filter_parameters($HTTP_POST_VARS) : ''));
	  }
	}

Hi dr_lucas

I am affraid of there are no error messages by this way.
The  $page['get'] and $page['post'] could be not isset when in array or $HTTP_GET_VARS or $HTTP_POST_VARS when no array.

but basicly both of $HTTP_GET_VARS and $HTTP_POST_VARS should be an array();

change only:
								'get' => $this->filter_parameters($page['get']),
								'post' => $this->filter_parameters($page['post']));

to:
								'get' => $this->filter_parameters(isset($page['get']) ? $page['get']) : ''),
								'post' => $this->filter_parameters(isset($page['post']) ? $page['post'] : ''));


Yes, you are right, Gergely, I thought the same actually, but wasn't sure so fixed both... :)
So just the part of the is_array needs to be bug-fixed.

By the way, small correction, the code should actually be (removed 1 bracket from the 'get' line):


'get' => $this->filter_parameters(isset($page['get']) ? $page['get'] : ''),
'post' => $this->filter_parameters(isset($page['post']) ? $page['post'] : ''));