-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
fix: test if gzip extension is available #308
Conversation
If "gzip" PHP extension is not loaded and there is no substitute in place, gzencode() does not exist and generation of compressed files will fail. Add a simple function_exists() test to prevent this.
f69266f
to
8f1bb49
Compare
If "gzip" PHP extension is not loaded and there is no substitute in place, gzencode() does not exist and generation of compressed files will fail. Add a simple function_exists() test to prevent this.
8f1bb49
to
a424ae4
Compare
If zlib PHP extension is not loaded and there is no substitute in place, gzencode() does not exist and generation of compressed files will fail. Add a simple function_exists() test to prevent this.
a424ae4
to
4a81107
Compare
It might seem little far fetched, but providing the add_filter( 'cachify_create_gzip_files', function ( $available ) {
if ( ! $available ) {
// Define or load anything that implements gzencode.
function gzencode( $data, $level ) {
return $data;
}
}
return true;
} ); |
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.
Looks good to me!
Just one thing: it would still be possible to use the filter although gzencode is not available, or not? I know this would be the problem of the one using the filter, but we could also safeguard this. What do you think?
In the current suggestion: Yes, you can still override the One might polyfill another compression routine on demand in the filter hook (see example above). Seems more of a theoretical possibility though. But I'd be fine changing the logic again, so the filter is completely omitted if |
If zlib PHP extension is not loaded and there is no substitute in place, gzencode() does not exist and generation of compressed files will fail. Add a simple function_exists() test to prevent this.
4a81107
to
5b884fe
Compare
If zlib PHP extension is not loaded and there is no substitute in place, gzencode() does not exist and generation of compressed files will fail. Add a simple function_exists() test to prevent this.
If zlib PHP extension is not loaded and there is no substitute in place, gzencode() does not exist and generation of compressed files will fail. Add a simple function_exists() test to prevent this.
5b884fe
to
bf0a4a3
Compare
I changed the logic, so if This is trivial to change again, but >99.9% should not need such tricky configurations. |
bf0a4a3
to
e9684e2
Compare
Quality Gate passedIssues Measures |
If zlib PHP extension is not loaded and there is no substitute in place,
gzencode()
does not exist and generation of compressed files will fail.Add a simple
function_exists()
test to prevent this.