-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix GH-20189: Tempnam notice message incorrect #20191
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
base: PHP-8.3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -303,7 +303,16 @@ PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, zend_strin | |
| if (temp_dir && | ||
| *temp_dir != '\0' && | ||
| (!(flags & PHP_TMP_FILE_OPEN_BASEDIR_CHECK_ON_FALLBACK) || !php_check_open_basedir(temp_dir))) { | ||
| return php_do_open_temporary_file(temp_dir, pfx, opened_path_p); | ||
| fd = php_do_open_temporary_file(temp_dir, pfx, opened_path_p); | ||
| if (!(flags & PHP_TMP_FILE_SILENT) && dir && *dir != '\0') { | ||
| /* Default temporary directory fallback. */ | ||
| if (UNEXPECTED(fd == -1)) { | ||
| /* TODO: decide whether we should notice that even the fallback failed? */ | ||
| } else { | ||
| php_error_docref(NULL, E_NOTICE, "file created in the system's temporary directory"); | ||
| } | ||
| } | ||
| return fd; | ||
| } else { | ||
| return -1; | ||
| } | ||
|
|
@@ -317,9 +326,6 @@ PHPAPI int php_open_temporary_fd_ex(const char *dir, const char *pfx, zend_strin | |
| fd = php_do_open_temporary_file(dir, pfx, opened_path_p); | ||
| if (fd == -1) { | ||
| /* Use default temporary directory. */ | ||
| if (!(flags & PHP_TMP_FILE_SILENT)) { | ||
| php_error_docref(NULL, E_NOTICE, "file created in the system's temporary directory"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternatively perhaps just:
Looking at
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see what you mean. I'm undecided yet, hence also the TODO I put
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should change the text completely (even for successful fallback creation) because some people can ignore error message by text in error handler (I saw that in some legacy code in past) so we don't want to break that (or more minimise chance of breaking it) if the target is 8.3. But different message in that TODO bit would make sense. |
||
| } | ||
| goto def_tmp; | ||
| } | ||
| return fd; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked and all callers trigger their own warning if the function fails so I think you should remove this TODO. Also if we really wanted such warning / notice, it should happen for non fallback as well...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see what you meant of keep that message after reading Tim's comment. I guess maybe that makes sense to add a noticed so people don't get confused actually.