Piwigo Bugtracker

Piwigo bug tracker has moved to Github

This bugtracker is kept to provide history on old issues.


View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002846Piwigoweb APIpublic2013.02.13 19:472013.03.10 13:16
Reporterthimo 
Assigned Torvelices 
PrioritynormalSeveritymajorReproducibilityalways
StatusfeedbackResolutionreopened 
PlatformOSOS Version
Product Version2.4.6 
Target Version2.5.0Fixed in Version2.5.0 
Summary0002846: pwg.images.search returns an error when called with f_* parameters
Descriptionpwg.images.search returns an error when called with at least two f_* parameters (eg. f_min_date_available and f_max_date_available):

Warning: [mysql error 1241] Operand should contain 1 column(s)

SELECT i.id,
    MATCH(i.name, i.comment) AGAINST( 'myquery' IN BOOLEAN MODE) AS weight
  FROM images i
  WHERE (MATCH(i.name, i.comment) AGAINST( 'myquery' IN BOOLEAN MODE)
    OR (CONVERT(file, CHAR) LIKE '%myquery%'))
 AND (i.date_available>='2013-02-10',i.date_available<'2013-02-13')
 AND 1 = 1 in /piwigo/include/dblayer/functions_mysql.inc.php on line 770


Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /piwigo/include/dblayer/functions_mysql.inc.php on line 153


FIX
/include/ws_functions.inc.php - line 1280:


  $search_result = get_quick_search_results($params['query'],
      $super_order_by,
- implode(',', $where_clauses)
+ implode(' AND ', $where_clauses)
    );




Also some limits are handled wrong (function ws_std_image_sql_filter):


function ws_std_image_sql_filter( $params, $tbl_name='' )
{
  $clauses = array();
  if ( is_numeric($params['f_min_rate']) )
  {
- $clauses[] = $tbl_name.'rating_score>'.$params['f_min_rate'];
+ $clauses[] = $tbl_name.'rating_score>='.$params['f_min_rate'];
  }
  if ( is_numeric($params['f_max_rate']) )
  {
    $clauses[] = $tbl_name.'rating_score<='.$params['f_max_rate'];
  }
  if ( is_numeric($params['f_min_hit']) )
  {
- $clauses[] = $tbl_name.'hit>'.$params['f_min_hit'];
+ $clauses[] = $tbl_name.'hit>='.$params['f_min_hit'];
  }
  if ( is_numeric($params['f_max_hit']) )
  {
    $clauses[] = $tbl_name.'hit<='.$params['f_max_hit'];
  }
  if ( isset($params['f_min_date_available']) )
  {
    $clauses[] = $tbl_name."date_available>='".$params['f_min_date_available']."'";
  }
  if ( isset($params['f_max_date_available']) )
  {
- $clauses[] = $tbl_name."date_available<'".$params['f_max_date_available']."'";
+ $clauses[] = $tbl_name."date_available<='".$params['f_max_date_available']."'";
  }
  if ( isset($params['f_min_date_created']) )
  {
    $clauses[] = $tbl_name."date_creation>='".$params['f_min_date_created']."'";
  }
  if ( isset($params['f_max_date_created']) )
  {
- $clauses[] = $tbl_name."date_creation<'".$params['f_max_date_created']."'";
+ $clauses[] = $tbl_name."date_creation<='".$params['f_max_date_created']."'";
  }
  if ( is_numeric($params['f_min_ratio']) )
  {
- $clauses[] = $tbl_name.'width/'.$tbl_name.'height>'.$params['f_min_ratio'];
+ $clauses[] = $tbl_name.'width/'.$tbl_name.'height>='.$params['f_min_ratio'];
  }
  if ( is_numeric($params['f_max_ratio']) )
  {
    $clauses[] = $tbl_name.'width/'.$tbl_name.'height<='.$params['f_max_ratio'];
  }
  if (is_numeric($params['f_max_level']) )
  {
    $clauses[] = $tbl_name.'level <= '.$params['f_max_level'];
  }
  return $clauses;
}
TagsNo tags attached.
browserany
Database engine and versionMySQL 5.5.28
PHP version
Web server
Attached Files

- Relationships

-  Notes
(0006858)
svn (reporter)
2013.02.24 13:25

[Subversion] r20999 by rvelices on trunk

-----[Subversion commit log]----------------------------------------------------
bug 2846: pwg.images.search sql error when called with f_* parameters
(0006879)
thimo (reporter)
2013.03.10 13:16

The field limits are still handled incorrectly.

- Issue History
Date Modified Username Field Change
2013.02.13 19:47 thimo New Issue
2013.02.13 19:47 thimo browser => any
2013.02.13 19:47 thimo Database engine and version => MySQL 5.5.28
2013.02.24 13:24 rvelices Assigned To => rvelices
2013.02.24 13:24 rvelices Status new => assigned
2013.02.24 13:24 rvelices Target Version => 2.5.0RC3
2013.02.24 13:25 svn Checkin
2013.02.24 13:25 svn Note Added: 0006858
2013.02.24 13:25 rvelices Status assigned => closed
2013.02.24 13:25 rvelices Resolution open => fixed
2013.02.24 13:25 rvelices Fixed in Version => 2.5.0RC3
2013.03.10 13:16 thimo Note Added: 0006879
2013.03.10 13:16 thimo Status closed => feedback
2013.03.10 13:16 thimo Resolution fixed => reopened


Copyright © 2000 - 2018 MantisBT Team
Contact
Powered by Mantis Bugtracker