[PHP-CVS] [php-src] master: streams: use php_stream_wrapper_warn() in _php_stream_open_wrapper_ex()

[email protected] (Gina Peter Banyard) Thu, 30 Jul 2026 08:51:16 +0000
Newsgroups php.cvs
Message-ID <[email protected]>
Author: Gina Peter Banyard (Girgias)
Date: 2026-07-30T09:51:09+01:00

Commit: https://github.com/php/php-src/commit/f9ac6c13c427ead81d26f068e6b00ca891443054
Raw diff: https://github.com/php/php-src/commit/f9ac6c13c427ead81d26f068e6b00ca891443054.diff

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.

Changed paths:
  M  main/streams/streams.c


Diff:

diff --git a/main/streams/streams.c b/main/streams/streams.c
index 3ec92b2a221f..506a23b3bf74 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -2137,9 +2137,8 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
 	}
 
 	if (!wrapper->wops->stream_opener) {
-		php_stream_wrapper_warn(wrapper, context, options,
-			NoOpener,
-			"wrapper does not support stream open");
+		php_stream_wrapper_warn(wrapper, context, options, NoOpener,
+				"Failed to open stream: wrapper does not support stream open");
 		if (resolved_path) {
 			zend_string_release_ex(resolved_path, 0);
 		}
@@ -2172,19 +2171,15 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
 	/* if the caller asked for a persistent stream but the wrapper did not
 	 * return one, force an error here */
 	if (persistent && !stream->is_persistent) {
-		php_stream_wrapper_log_warn(wrapper, context, options & ~REPORT_ERRORS,
-				PersistentNotSupported,
-				"wrapper does not support persistent streams");
+		php_stream_wrapper_warn(wrapper, context, options, PersistentNotSupported,
+				"Failed to open stream: wrapper does not support persistent streams");
 		php_stream_close(stream);
 		if (options & REPORT_ERRORS) {
-			php_stream_display_wrapper_name_errors(wrapper_name, context, PHP_STREAM_EC(OpenFailed),
-					"Failed to open stream");
 			if (opened_path && *opened_path) {
 				zend_string_release_ex(*opened_path, 0);
 				*opened_path = NULL;
 			}
 		}
-		php_stream_tidy_wrapper_name_error_log(wrapper_name);
 		pefree(wrapper_name, persistent);
 		if (resolved_path) {
 			zend_string_release_ex(resolved_path, 0);
@@ -2242,7 +2237,6 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
 				php_stream_wrapper_warn(wrapper, context, options,
 						SeekNotSupported,
 						"could not make seekable - %s", path);
-				php_stream_tidy_wrapper_name_error_log(wrapper_name);
 				pefree(wrapper_name, persistent);
 				if (resolved_path) {
 					zend_string_release_ex(resolved_path, 0);