Overview
Comment: | Fix: list of saved searches in mailing generated an error when a LIMIT was present |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dev |
Files: | files | file ages | folders |
SHA3-256: |
a823cbe5d1ad4deedda283c5ac795d5d |
User & Date: | bohwaz on 2023-06-04 11:46:19 |
Other Links: | branch diff | manifest | tags |
Context
2023-06-04
| ||
18:34 | Fix undefined variable check-in: c8049e528e user: bohwaz tags: dev | |
11:46 | Fix: list of saved searches in mailing generated an error when a LIMIT was present check-in: a823cbe5d1 user: bohwaz tags: dev | |
11:36 | Fix: ::class does not work with $this apparently check-in: 3354439ce6 user: bohwaz tags: dev | |
Changes
Modified src/include/lib/Garradin/Entities/Search.php from [255ff632d7] to [963f668a8c].
︙ | ︙ | |||
123 124 125 126 127 128 129 | $sql = $this->content; } $has_limit = preg_match('/LIMIT\s+\d+/i', $sql); // force LIMIT if (!empty($options['limit'])) { | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | $sql = $this->content; } $has_limit = preg_match('/LIMIT\s+\d+/i', $sql); // force LIMIT if (!empty($options['limit'])) { $sql = preg_replace($has_limit ? '/LIMIT\s+.*$/is' : '/;.*$/s', '', trim($sql)); $sql .= ' LIMIT ' . (int) $options['limit']; } elseif (!empty($options['no_limit']) && $has_limit) { $sql = preg_replace('/LIMIT\s+.*;?\s*$/', '', $sql); } if (!empty($options['select_also'])) { |
︙ | ︙ | |||
169 170 171 172 173 174 175 176 177 178 179 180 181 182 | if (empty($options['no_cache'])) { $this->_result = $result; } return $result; } catch (DB_Exception $e) { throw new UserException('Erreur dans la requête : ' . $e->getMessage(), 0, $e); } finally { $db->toggleUnicodeLike(false); } } | > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | if (empty($options['no_cache'])) { $this->_result = $result; } return $result; } catch (DB_Exception $e) { throw $e; throw new UserException('Erreur dans la requête : ' . $e->getMessage(), 0, $e); } finally { $db->toggleUnicodeLike(false); } } |
︙ | ︙ | |||
205 206 207 208 209 210 211 | { $sql = $this->SQL(); if (!preg_match('/(?:FROM|JOIN)\s+users/i', $sql)) { return false; } | | | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | { $sql = $this->SQL(); if (!preg_match('/(?:FROM|JOIN)\s+users/i', $sql)) { return false; } $header = $this->getHeader(['limit' => 1, 'no_cache' => true]); if (!in_array('id', $header) && !in_array('_user_id', $header)) { return false; } return true; } |
︙ | ︙ |