Fix six audit findings; bring tests up to PHP 8.5#85
Merged
Conversation
* itunes:block now only emits for "yes"/"Yes" per Apple's spec;
previously any non-empty value (including the example "no" in
dir2cast.ini) was emitted, which blocks the feed from directories.
* Per-MP3-dir dir2cast.ini's mtime now invalidates the cache via a
new LOCAL_INI_FILE constant tracked alongside INI_FILE; editing a
per-podcast ini no longer silently serves stale cached output.
* Caching_getID3_Podcast_Helper::addNamespaceTo now delegates to the
wrapped helper's addNamespaceTo (was calling appendToChannel).
* ?force=... password compare now uses hash_equals() with explicit
string casts: avoids PHP's numeric-string coercion in == ("01" == "1",
"0e1234" == "0e5678") and timing leaks.
* HTTP Last-modified header now uses RFC 7231 IMF-fixdate (" GMT")
instead of RFC 2822 (" +0000"); some intermediaries rejected the
non-conforming form. RSS <lastBuildDate> still uses RFC 2822.
* HTTP Last-modified falls back to the cache file's mtime when the
cached XML lacks an extractable <lastBuildDate>.
Each fix is preceded by a test that fails on the buggy code.
Also fixes the test suite for newer PHPs and expands CI coverage:
* bootstrap.php: handle E_STRICT removal in PHP 8.5.
* bootstrap.php: fake_getopt rewritten to pass user argv as real CLI
args; PHP 8.4+ ignores $GLOBALS['argv'] for getopt().
* .github/workflows/testing.yml: matrix now covers 8.3, 8.4, 8.5;
macos-11 -> macos-latest (older runner retired).
Version bumped to 1.39.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six bug fixes from a code audit, each preceded by a test that fails on the buggy code. Plus prerequisite work to get the test suite running on PHP 8.4/8.5 and to expand the CI matrix.
Bug fixes
<itunes:block>only emits foryes/Yes— previously any non-empty value (including the example"no"indir2cast.ini) was emitted, contradicting Apple's spec and silently blocking feeds from podcast directories.dir2cast.inimtime now invalidates the cache — newLOCAL_INI_FILEconstant tracked alongsideINI_FILE. Editing a per-podcast ini no longer silently serves stale cached output.Caching_getID3_Podcast_Helper::addNamespaceTodelegates correctly — was calling the wrapped helper'sappendToChannelinstead ofaddNamespaceTo.?force=…password compare useshash_equalswith explicit string casts — avoids PHP's numeric-string coercion in==("01" == "1","0e1234" == "0e5678") and timing leaks.Last-modifiedheader uses RFC 7231 IMF-fixdate (GMT) instead of RFC 2822 (+0000); some intermediaries reject the non-conforming form. RSS<lastBuildDate>still uses RFC 2822 as required.Last-modifiedfalls back to the cache file's mtime when the cached XML lacks an extractable<lastBuildDate>(avoids emitting an empty header).Test / CI work
bootstrap.php: handleE_STRICTremoval in PHP 8.5 (usedefined()+ runtimeconstant()lookup so the symbol is never referenced when absent).bootstrap.php:fake_getoptrewritten to pass user argv as real CLI args after--. PHP 8.4+ ignores$GLOBALS['argv']forgetopt(), so the previous injection-based mocking returned an empty array..github/workflows/testing.yml: matrix now covers PHP 8.3, 8.4, 8.5 (was 7.3–8.2).macos-11→macos-latest(the older runner has been retired).Version bumped to 1.39,
CHANGELOG.txtandREADME.mdupdated,dir2cast.iniexample forITUNES_BLOCKupdated.Net: 1062 tests pass on PHP 8.5 locally (up from 1041 on
main— 21 new tests).Test plan
?force=…still uncaches with a correct passwordITUNES_BLOCK = "yes"emits<itunes:block>yes</itunes:block>; one with"no"or unset omits itdir2cast.initriggers a cache rebuild on the next requestLast-modified: …, … GMT(not+0000)🤖 Generated with Claude Code