Repository navigation
Oo #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oo #49
Changes from all commits
21d6e09
9375646
b45c306
e91cd24
a43181b
08385a3
3b94ed5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,7 +88,9 @@ public function handleRequest(): void | |
| } catch (Throwable $e) { | ||
| error_log('[API] ' . $e->getMessage()); | ||
| http_response_code(500); | ||
| $this->emit($this->builder->errorOnly('internal error')); | ||
| $result = $this->builder->errorOnly('internal error'); | ||
| $result["e"] = $e->getMessage(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Security — raw exception messages are now echoed to API clients.
The codebase already has a gate for exactly this — $result = $this->builder->errorOnly('internal error');
if (Environment::isLocalhost()) {
$result['e'] = $e->getMessage();
}
$this->emit($result);(Side note: this PR also removed the |
||
| $this->emit($result); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,6 +119,7 @@ public function fetchQuery(string $sqlQuery, ?array $params = null): array | |
| return $stmt->fetchAll(PDO::FETCH_ASSOC); | ||
| } catch (PDOException $e) { | ||
| Logger::error('SQL Error in fetchQuery: ' . $e->getMessage() . ' | Query: ' . $sqlQuery); | ||
| Logger::debug('SQL Error in fetchQuery: Query: ' . $sqlQuery); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: this |
||
| throw new DatabaseException('Query failed', 0, $e); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 This description is inaccurate for
get_lang_years.It's copied from the old
user_lang_statusalias, butget_lang_yearsno longer redirects — it's a real endpoint returning the distinct years present inpages, optionally filtered bylang. Something like:Also consider the endpoint name itself: every other endpoint is a bare noun (
langs,pages,views, …), soget_lang_yearsreads like a function call.lang_yearswould match the house style — and this row is also out of alphabetical order, since it was left whereuser_lang_statusused to sit.