summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-06 19:15:57 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-06 19:15:57 +0100
commit28332b74759d85135fa4242f75824349ce766f83 (patch)
tree9ec90c5f54d2a9c4816fdb0330b48e1d2eadc7d3 /templates
parente245a4e9778354b9e75f4ef652ee351e45ca9f7f (diff)
downloadthemes-28332b74759d85135fa4242f75824349ce766f83.tar.gz
themes-28332b74759d85135fa4242f75824349ce766f83.tar.bz2
themes-28332b74759d85135fa4242f75824349ce766f83.zip
themes: fix APCu-poisoning of mRawFiles causing duplicate JS/CSS headers
cleanAuxFiles() was converting mRawFiles filesystem paths to URL?filemtime strings in-place. Because mRawFiles is serialised into APCu, the URL form was persisted across requests. On the next request, isAuxFile(path) did in_array(path, [URL?timestamp]) — always a miss — so the file was added again at the next free position. Each request added another copy, growing the header indefinitely. Fix: cleanAuxFiles() now writes converted URLs into a new mRawUrls property (not in __sleep(), so never serialised) and leaves mRawFiles untouched as stable filesystem paths. html_head_inc.tpl reads mRawUrls for rendering. Also fixes a pre-existing strpos('?', $file) arg-order bug — the needle and haystack were swapped, so the ?/& separator was always wrong. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/html_head_inc.tpl8
1 files changed, 4 insertions, 4 deletions
diff --git a/templates/html_head_inc.tpl b/templates/html_head_inc.tpl
index 0c2c1cd..bb93d88 100755
--- a/templates/html_head_inc.tpl
+++ b/templates/html_head_inc.tpl
@@ -1,11 +1,11 @@
{strip}
-{if !empty($gBitThemes->mRawFiles.css)}
- {foreach from=$gBitThemes->mRawFiles.css item=cssFile}
+{if !empty($gBitThemes->mRawUrls.css)}
+ {foreach from=$gBitThemes->mRawUrls.css item=cssFile}
<link rel="stylesheet" title="{$style|default:'css'}" nonce="{$cspNonce}" type="text/css" href="{$cssFile}" media="all" />
{/foreach}
{/if}
-{if !empty($gBitThemes->mRawFiles.js)}
- {foreach from=$gBitThemes->mRawFiles.js item=jsFile}
+{if !empty($gBitThemes->mRawUrls.js)}
+ {foreach from=$gBitThemes->mRawUrls.js item=jsFile}
<script nonce="{$cspNonce}" src="{$jsFile}"></script>
{/foreach}
{/if}