Index: branches/5.2.x/core/units/helpers/search_helper.php =================================================================== diff -u -r16692 -r16797 --- branches/5.2.x/core/units/helpers/search_helper.php (.../search_helper.php) (revision 16692) +++ branches/5.2.x/core/units/helpers/search_helper.php (.../search_helper.php) (revision 16797) @@ -1,6 +1,6 @@ Application->GetSID().'(_[\d]+){0,1}_edit_(.*)/', $table_name, $regs); - if ($is_temp_table) { - $table_name = $regs[1].TABLE_PREFIX.'ses_'.EDIT_MARK.'_edit_'.$regs[3]; // edit_mark will be replaced with sid[_main_wid] in AddFilters + // Replace wid inside table name to WID_MARK constant value. + $is_temp_table = preg_match( + '/(.*)' . TABLE_PREFIX . 'ses_[\d]+(_[\d]+){0,1}_edit_(.*)/', + $table_name, + $regs + ); + + // The EDIT_MARK will be replaced with sid[_main_wid] in AddFilters. + if ( $is_temp_table ) { + $table_name = $regs[1] . TABLE_PREFIX . 'ses_' . EDIT_MARK . '_edit_' . $regs[3]; } return Array ($field_name, $field_type, $table_name, $sql_filter_type); @@ -855,7 +861,21 @@ */ public function getSearchTable() { - return TABLE_PREFIX . 'ses_' . $this->Application->GetSID() . '_' . TABLE_PREFIX . 'Search'; + try { + $sid = $this->Application->GetSID(Session::PURPOSE_REFERENCE); + } + catch ( RuntimeException $e ) { + // 1. Put some real variable into session, or otherwise it won't even save to the database. + $this->Application->StoreVar('search_made', 'yes'); + + // 2. Create session on they fly to store search results. + $this->Application->Session->SaveData(); + + // 3. Get ID of the created session. + $sid = $this->Application->GetSID(Session::PURPOSE_REFERENCE); + } + + return TABLE_PREFIX . 'ses_' . $sid . '_' . TABLE_PREFIX . 'Search'; } }