Skip to content

Conversation

@craftogrammer
Copy link

No description provided.

// Respect ETags served with feeds.
$three04 = false;
if ( isset( $SERVER['HTTP_IF_NONE_MATCH'] ) && isset( $batcache->cache['headers']['ETag'][0] ) && $_SERVER['HTTP_IF_NONE_MATCH'] == $batcache->cache['headers']['ETag'][0] )
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && isset( $batcache->cache['headers']['ETag'][0] ) && $_SERVER['HTTP_IF_NONE_MATCH'] === $batcache->cache['headers']['ETag'][0] )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

if ( !empty( $this->cache['headers'] ) && !empty( $this->uncached_headers ) ) {
foreach ( $this->uncached_headers as $header )
unset( $this->cache['headers'][$header] );
foreach ( $this->uncached_headers as $h ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason we can't use the full descriptive variable name? $h may be quicker to type but it hides the purpose of the variable and makes the rest of the code less readable

Comment on lines +261 to +268
foreach ( $this->uncached_headers as $h ) {
foreach ( array_keys( $this->cache['headers'] ) as $k ) {
if ( strcasecmp( $k, $h ) === 0 ) {
unset( $this->cache['headers'][ $k ] );
break;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way we can reduce the nested for loops with array_map/filter/walk?

@tomjn
Copy link
Contributor

tomjn commented Oct 16, 2025

@craftogrammer nice changes but could we add a PR description? I've left some feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants