Skip to content

Promote some warnings from streams to errors. #5076

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions main/streams/plain_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, zen

if (FAILURE == php_stream_parse_fopen_modes(mode, &open_flags)) {
if (options & REPORT_ERRORS) {
php_error_docref(NULL, E_WARNING, "`%s' is not a valid mode for fopen", mode);
zend_value_error("`%s' is not a valid mode for fopen", mode);
}
return NULL;
}
Expand Down Expand Up @@ -1464,7 +1464,7 @@ static int php_plain_files_metadata(php_stream_wrapper *wrapper, const char *url
ret = VCWD_CHMOD(url, mode);
break;
default:
php_error_docref1(NULL, url, E_WARNING, "Unknown option %d for stream_metadata", option);
zend_value_error("Unknown option %d for stream_metadata", option);
return 0;
}
if (ret == -1) {
Expand Down Expand Up @@ -1561,6 +1561,7 @@ PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char
*(cwd+3) = '\0';

if (snprintf(trypath, MAXPATHLEN, "%s%s", cwd, filename) >= MAXPATHLEN) {
/* Raise to warning? */
Copy link
Member Author

Choose a reason for hiding this comment

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

@nikic Should I remove those comments or promote the notices to warnings?

php_error_docref(NULL, E_NOTICE, "%s/%s path was truncated to %d", cwd, filename, MAXPATHLEN);
}

Expand Down Expand Up @@ -1616,6 +1617,7 @@ PHPAPI php_stream *_php_stream_fopen_with_path(const char *filename, const char
goto stream_skip;
}
if (snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename) >= MAXPATHLEN) {
/* Raise to warning? */
php_error_docref(NULL, E_NOTICE, "%s/%s path was truncated to %d", ptr, filename, MAXPATHLEN);
}

Expand Down