Skip to content

zlib: use new stream error API#22741

Draft
Girgias wants to merge 2 commits into
php:masterfrom
Girgias:2026-07-stream-error-zlib
Draft

zlib: use new stream error API#22741
Girgias wants to merge 2 commits into
php:masterfrom
Girgias:2026-07-stream-error-zlib

Conversation

@Girgias

@Girgias Girgias commented Jul 15, 2026

Copy link
Copy Markdown
Member

Converting to draft, as I think we need to fix some other issues regarding stream errors now that E_WARNINGs messages with arguments is something that is controlled by an INI setting, something which the current stream error API doesn't handle well.

Comment on lines +208 to +215
if (UNEXPECTED(failed)) {
/* TODO: keep options arg instead of REPORT_ERRORS? Fix _php_stream_open_wrapper_ex() to not clear report errors flag? */
php_stream_wrapper_log_warn(wrapper, context, REPORT_ERRORS, InvalidParam,
"zlib \"level\" context option must be of type int, %s given", zend_zval_type_name(zlevel));
} else if (Z_OK != gzsetparams(self->gz_file, level, Z_DEFAULT_STRATEGY)) {
php_stream_wrapper_log_warn(wrapper, context, REPORT_ERRORS, Generic,
"failed setting compression level");
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The reason those warnings don't appear if we use options is because the REPORT_ERRORS flag is negated when calling the wrapper ops, but also because we do return a string, so the caller just expects no warnings to have occurred.

I'm experimenting with not negating the flag in the first place at the wrapper level.

@Girgias Girgias marked this pull request as draft July 15, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant