Skip to content

Commit 3a5b714

Browse files
committed
streams: use php_stream_wrapper_warn() in _php_stream_open_wrapper_ex()
Instead of the old way of logging errors and displaying them use the new APIs.
1 parent d6d60c4 commit 3a5b714

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

main/streams/streams.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,17 +2122,16 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
21222122
if ((options & STREAM_USE_URL) && !wrapper->is_url) {
21232123
php_stream_wrapper_warn(wrapper, context, options,
21242124
ProtocolUnsupported,
2125-
"This function may only be used against URLs");
2125+
"Failed to open stream: This function may only be used against URLs");
21262126
if (resolved_path) {
21272127
zend_string_release_ex(resolved_path, 0);
21282128
}
21292129
return NULL;
21302130
}
21312131

21322132
if (!wrapper->wops->stream_opener) {
2133-
php_stream_wrapper_warn(wrapper, context, options,
2134-
NoOpener,
2135-
"wrapper does not support stream open");
2133+
php_stream_wrapper_warn(wrapper, context, options, NoOpener,
2134+
"Failed to open stream: wrapper does not support stream open");
21362135
if (resolved_path) {
21372136
zend_string_release_ex(resolved_path, 0);
21382137
}
@@ -2165,19 +2164,15 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
21652164
/* if the caller asked for a persistent stream but the wrapper did not
21662165
* return one, force an error here */
21672166
if (persistent && !stream->is_persistent) {
2168-
php_stream_wrapper_log_warn(wrapper, context, options & ~REPORT_ERRORS,
2169-
PersistentNotSupported,
2170-
"wrapper does not support persistent streams");
2167+
php_stream_wrapper_warn(wrapper, context, options, PersistentNotSupported,
2168+
"Failed to open stream: wrapper does not support persistent streams");
21712169
php_stream_close(stream);
21722170
if (options & REPORT_ERRORS) {
2173-
php_stream_display_wrapper_name_errors(wrapper_name, context, PHP_STREAM_EC(OpenFailed),
2174-
"Failed to open stream");
21752171
if (opened_path && *opened_path) {
21762172
zend_string_release_ex(*opened_path, 0);
21772173
*opened_path = NULL;
21782174
}
21792175
}
2180-
php_stream_tidy_wrapper_name_error_log(wrapper_name);
21812176
pefree(wrapper_name, persistent);
21822177
if (resolved_path) {
21832178
zend_string_release_ex(resolved_path, 0);
@@ -2235,7 +2230,6 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
22352230
php_stream_wrapper_warn(wrapper, context, options,
22362231
SeekNotSupported,
22372232
"could not make seekable - %s", path);
2238-
php_stream_tidy_wrapper_name_error_log(wrapper_name);
22392233
pefree(wrapper_name, persistent);
22402234
if (resolved_path) {
22412235
zend_string_release_ex(resolved_path, 0);

0 commit comments

Comments
 (0)