fix: avoid DOMDocument in favicon parsing#11801
Conversation
Greptile SummaryThis PR replaces The implementation:
Both issues flagged in previous review threads have been correctly addressed: the attribute-value falsy-coalesce is now strict ( Confidence Score: 5/5This PR is safe to merge; it is a targeted, well-scoped fix with no new correctness issues. Both previously identified issues (falsy attribute coalesce and HTML comment handling) have been properly resolved. The regex-based approach correctly preserves all prior behavior: SVG prioritization, largest-icon selection, and /favicon.ico fallback. No P0 or P1 issues remain. Remaining theoretical edge cases (script tag with embedded > in attribute, reversed rel token order) are pre-existing or extremely low-impact and do not affect real-world favicon detection. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "Ignore script and style blocks in favico..." | Re-trigger Greptile |
🔄 PHP-Retry SummaryFlaky tests detected across commits: Commit
|
| Test | Retries | Total Time | Details |
|---|---|---|---|
UsageTest::testVectorsDBStats |
1 | 10.13s | Logs |
Commit 9dbc32d - 5 flaky tests
| Test | Retries | Total Time | Details |
|---|---|---|---|
LegacyConsoleClientTest::testListDocumentsWithCache |
1 | 282ms | Logs |
LegacyCustomClientTest::testCreateIndexes |
1 | 243.22s | Logs |
LegacyCustomServerTest::testAttributeResponseModels |
1 | 241.74s | Logs |
LegacyCustomServerTest::testUniqueIndexDuplicate |
1 | 240.44s | Logs |
UsageTest::testVectorsDBStats |
1 | 10.13s | Logs |
✨ Benchmark results
⚡ Benchmark Comparison
|
What
Replace
DOMDocument::loadHTML()in the favicon avatar route with inline<link>tag parsing.Why
The favicon route only needs to read
href,rel, andsizesfrom icon<link>tags. UsingDOMDocumentpulls in libxml HTML parsing for that small task, and this path was failing under the coroutine server.This change keeps the existing behavior intact:
<link>tagssvgico/png/jpg/jpeg/favicon.icoScope
This PR only changes:
src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.phpVerification
composer format src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.phpcomposer lint src/Appwrite/Platform/Modules/Avatars/Http/Favicon/Get.phpdocker compose exec -T appwrite test tests/e2e/Services/Avatars --filter='/::testGetFavicon$/'docker compose exec -T appwrite test tests/e2e/Services/GraphQL/AvatarsTest.php --filter='/::testGetFavicon$/'