Commit 62da58acbde for php

commit 62da58acbde764c2b3d239f0a7d976c676f23b81
Author: Gina Peter Banyard <girgias@php.net>
Date:   Tue Oct 13 21:25:16 2026 +0100

    stream: refactor php_stream_from_persistent_id() to return enum

diff --git a/main/php_streams.h b/main/php_streams.h
index 37e1f3e01b0..54baead30fe 100644
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -341,10 +341,14 @@ static zend_always_inline bool php_stream_zend_parse_arg_into_stream(
 PHPAPI php_stream *php_stream_encloses(php_stream *enclosing, php_stream *enclosed);
 PHPAPI int php_stream_free_enclosed(php_stream *stream_enclosed, int close_options);

-PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream);
-#define PHP_STREAM_PERSISTENT_SUCCESS	0 /* id exists */
-#define PHP_STREAM_PERSISTENT_FAILURE	1 /* id exists but is not a stream! */
-#define PHP_STREAM_PERSISTENT_NOT_EXIST	2 /* id does not exist */
+
+C23_ENUM(php_stream_persistent_status, uint8_t) {
+	PHP_STREAM_PERSISTENT_SUCCESS = 0, /* id exists */
+	PHP_STREAM_PERSISTENT_FAILURE = 1, /* id exists but is not a stream! */
+	PHP_STREAM_PERSISTENT_NOT_EXIST	= 2, /* id does not exist */
+};
+
+PHPAPI php_stream_persistent_status php_stream_from_persistent_id(const char *persistent_id, php_stream **stream);

 #define PHP_STREAM_FREE_CALL_DTOR			1 /* call ops->close */
 #define PHP_STREAM_FREE_RELEASE_STREAM		2 /* pefree(stream) */
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index ccf38ca0d54..37693660791 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -1220,6 +1220,9 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, zen
 			case PHP_STREAM_PERSISTENT_FAILURE:
 				efree(persistent_id);
 				return ret;
+			case PHP_STREAM_PERSISTENT_NOT_EXIST:
+				/* Fallthrough to open new stream */
+				break;
 		}
 	}
 #ifdef PHP_WIN32
diff --git a/main/streams/streams.c b/main/streams/streams.c
index d332cc7f9a3..3e948add11f 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -105,7 +105,7 @@ PHPAPI php_stream *php_stream_encloses(php_stream *enclosing, php_stream *enclos
 	return orig;
 }

-PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream)
+PHPAPI php_stream_persistent_status php_stream_from_persistent_id(const char *persistent_id, php_stream **stream)
 {
 	zend_resource *le;

diff --git a/main/streams/transports.c b/main/streams/transports.c
index a1410aa4a0e..f8f74c60614 100644
--- a/main/streams/transports.c
+++ b/main/streams/transports.c
@@ -84,7 +84,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
 				/* fall through */

 			case PHP_STREAM_PERSISTENT_FAILURE:
-			default:
+			case PHP_STREAM_PERSISTENT_NOT_EXIST:
 				/* failed; get a new one */
 				;
 		}