Skip to content

Commit b36ff7e

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 c5ca657 commit b36ff7e

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

main/streams/streams.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,9 +2130,8 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
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,13 +2164,10 @@ 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;
@@ -2232,18 +2228,14 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
22322228
return newstream;
22332229
default:
22342230
php_stream_close(stream);
2235-
php_stream_wrapper_warn(wrapper, context, options,
2236-
SeekNotSupported,
2237-
"could not make seekable - %s", path);
2231+
php_stream_wrapper_warn(wrapper, context, options, SeekNotSupported,
2232+
"Failed to open stream: could not make seekable - %s", path);
22382233
if (options & REPORT_ERRORS) {
2239-
php_stream_display_wrapper_name_errors(wrapper_name, context, PHP_STREAM_EC(OpenFailed),
2240-
"Failed to open stream");
22412234
if (opened_path && *opened_path) {
22422235
zend_string_release_ex(*opened_path, 0);
22432236
*opened_path = NULL;
22442237
}
22452238
}
2246-
php_stream_tidy_wrapper_name_error_log(wrapper_name);
22472239
pefree(wrapper_name, persistent);
22482240
if (resolved_path) {
22492241
zend_string_release_ex(resolved_path, 0);

0 commit comments

Comments
 (0)