From 0f72e3d58d851c35c82202151452c79dbc6436cf Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 23 Jul 2015 11:49:41 +0000 Subject: [PATCH] an other one: fix sql error if link-id (accidently) contains non-ascii chars --- phpgwapi/inc/class.solink.inc.php | 33 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/phpgwapi/inc/class.solink.inc.php b/phpgwapi/inc/class.solink.inc.php index 3f0f5545b8..527ebba8a6 100644 --- a/phpgwapi/inc/class.solink.inc.php +++ b/phpgwapi/inc/class.solink.inc.php @@ -303,20 +303,27 @@ class solink } } $deleted = array(); - foreach(self::$db->select(self::TABLE,'*',$where,__LINE__,__FILE__) as $row) - { - $deleted[] = $row; + try { + foreach(self::$db->select(self::TABLE,'*',$where,__LINE__,__FILE__) as $row) + { + $deleted[] = $row; + } + if($hold_for_purge) + { + self::$db->update(self::TABLE,array( + 'deleted' => time(), + 'link_lastmod' => time(), + ), $where, __LINE__,__FILE__); + } + else + { + self::$db->delete(self::TABLE,$where,__LINE__,__FILE__); + } } - if($hold_for_purge) - { - self::$db->update(self::TABLE,array( - 'deleted' => time(), - 'link_lastmod' => time(), - ), $where, __LINE__,__FILE__); - } - else - { - self::$db->delete(self::TABLE,$where,__LINE__,__FILE__); + // catch Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' (1267) + // caused by non-ascii chars compared with ascii field uid + catch(egw_exception_db $e) { + _egw_log_exception($e); } return $deleted;