Open Source PHP RAD Framework with UI.

parameters passed to pagination, gives htmlentities error

Reported by Adrian Liechti on 2012-02-17
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PHPDevShell
High
TitanKing

Bug Description

Some interresting error is happening, when i add the parameters array to the pagination.

Error:
htmlentities() expects parameter 1 to be string, array given

The array is like this:
$parameters = array(
 'userId' => $this->configuration['user_id'],
 'removed' => 0,
 'expiresAfter' => '2012-02-17 12:00:00'
);

The errorpage and the qeryfile are attached

Adrian Liechti (jahweh) wrote :
Adrian Liechti (jahweh) wrote :

Change the query-method in the pagination-class:

public function query($sql)
{
 // Get all parameters.
 $params = func_get_args();
  //array_shift($params); // first parameter of this function is query.
 /**
  * @author Adrian Liechti
  * To make it Possible to give the Query-Method an Array.
  */
 if (is_array($params[1])) {
  $paramArray = $params[1];
  array_unshift($paramArray, $params[0]);
  $params = $paramArray;
 }

 $this->searchFilter();
 return $this->finalQuery($params);
}

But there are more problems with the pagination! The parameters are not used, because the pagination should extend the PHPDS_query-class but it doesn't extend it.

My workaround looks like this:

public function invoke($parameters = null)
 {
  $pagination = $this->factory('pagination');

  $this->extraBuild($parameters);
  if (!empty($this->where)) {
   $this->sql .= "\n".'WHERE '.$this->where;
  }
  if (!empty($this->groupby)) {
   $this->sql .= "\n".'GROUP BY '.$this->groupby;
  }

  $get_results = $pagination->query($this->sql, $parameters);
//.........

But with this workaround you have to remove the search-function, because the pagination cannot handle the WHERE and GROUP BY etc. separately.

TitanKing (titan-phpdevshell) wrote :

I Adrian, the pagination class needs some attention, give me a week or two, to sort this out.

Changed in phpdevshell:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → TitanKing (titan-phpdevshell)
milestone: none → 3.2.1-stable
Greg (gregfr) wrote :

This bug is related to #1019595; in fact bug #1019595 hides the actual bug reported here.

Greg (gregfr) on 2013-06-11
Changed in phpdevshell:
milestone: 3.2.1-stable → none
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers