Skip to content

Commit ffa5716

Browse files
committed
Clear error flag instead of toggling it
The toggling of the `REPORT_ERRORS` looks fishy, and likely was intented as clearing. Closes GH-6190.
1 parent 5783e61 commit ffa5716

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

main/streams/streams.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,15 +2038,15 @@ PHPAPI php_stream *_php_stream_opendir(const char *path, int options,
20382038

20392039
if (wrapper && wrapper->wops->dir_opener) {
20402040
stream = wrapper->wops->dir_opener(wrapper,
2041-
path_to_open, "r", options ^ REPORT_ERRORS, NULL,
2041+
path_to_open, "r", options & ~REPORT_ERRORS, NULL,
20422042
context STREAMS_REL_CC);
20432043

20442044
if (stream) {
20452045
stream->wrapper = wrapper;
20462046
stream->flags |= PHP_STREAM_FLAG_NO_BUFFER | PHP_STREAM_FLAG_IS_DIR;
20472047
}
20482048
} else if (wrapper) {
2049-
php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS, "not implemented");
2049+
php_stream_wrapper_log_error(wrapper, options & ~REPORT_ERRORS, "not implemented");
20502050
}
20512051
if (stream == NULL && (options & REPORT_ERRORS)) {
20522052
php_stream_display_wrapper_errors(wrapper, path, "Failed to open directory");
@@ -2115,18 +2115,18 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
21152115

21162116
if (wrapper) {
21172117
if (!wrapper->wops->stream_opener) {
2118-
php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS,
2118+
php_stream_wrapper_log_error(wrapper, options & ~REPORT_ERRORS,
21192119
"wrapper does not support stream open");
21202120
} else {
21212121
stream = wrapper->wops->stream_opener(wrapper,
2122-
path_to_open, mode, options ^ REPORT_ERRORS,
2122+
path_to_open, mode, options & ~REPORT_ERRORS,
21232123
opened_path, context STREAMS_REL_CC);
21242124
}
21252125

21262126
/* if the caller asked for a persistent stream but the wrapper did not
21272127
* return one, force an error here */
21282128
if (stream && (options & STREAM_OPEN_PERSISTENT) && !stream->is_persistent) {
2129-
php_stream_wrapper_log_error(wrapper, options ^ REPORT_ERRORS,
2129+
php_stream_wrapper_log_error(wrapper, options & ~REPORT_ERRORS,
21302130
"wrapper does not support persistent streams");
21312131
php_stream_close(stream);
21322132
stream = NULL;
@@ -2183,7 +2183,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
21832183
tmp);
21842184
efree(tmp);
21852185

2186-
options ^= REPORT_ERRORS;
2186+
options &= ~REPORT_ERRORS;
21872187
}
21882188
}
21892189
}

0 commit comments

Comments
 (0)