@@ -83,8 +83,23 @@ static void php_stream_error_create_array(zval *zv, php_stream_error_entry *firs
8383}
8484
8585/* Context option helpers */
86-
87- static int php_stream_auto_decide_error_store_mode (int error_mode )
86+ /* Error mode context options (internal C constants) */
87+ C23_ENUM (php_stream_error_mode , uint8_t ) {
88+ PHP_STREAM_ERROR_MODE_ERROR = 0 ,
89+ PHP_STREAM_ERROR_MODE_EXCEPTION = 1 ,
90+ PHP_STREAM_ERROR_MODE_SILENT = 2
91+ };
92+
93+ /* Error store context options (internal C constants) */
94+ C23_ENUM (php_stream_error_store , uint8_t ) {
95+ PHP_STREAM_ERROR_STORE_AUTO = 0 ,
96+ PHP_STREAM_ERROR_STORE_NONE = 1 ,
97+ PHP_STREAM_ERROR_STORE_NON_TERM = 2 ,
98+ PHP_STREAM_ERROR_STORE_TERMINAL = 3 ,
99+ PHP_STREAM_ERROR_STORE_ALL = 4
100+ };
101+
102+ static php_stream_error_store php_stream_auto_decide_error_store_mode (php_stream_error_mode error_mode )
88103{
89104 switch (error_mode ) {
90105 case PHP_STREAM_ERROR_MODE_ERROR :
@@ -98,7 +113,7 @@ static int php_stream_auto_decide_error_store_mode(int error_mode)
98113 }
99114}
100115
101- static int php_stream_get_error_mode (php_stream_context * context )
116+ static php_stream_error_mode php_stream_get_error_mode (php_stream_context * context )
102117{
103118 if (!context ) {
104119 return PHP_STREAM_ERROR_MODE_ERROR ;
@@ -127,7 +142,8 @@ static int php_stream_get_error_mode(php_stream_context *context)
127142 return PHP_STREAM_ERROR_MODE_ERROR ;
128143}
129144
130- static int php_stream_get_error_store_mode (php_stream_context * context , int error_mode )
145+ static php_stream_error_store php_stream_get_error_store_mode (
146+ php_stream_context * context , php_stream_error_mode error_mode )
131147{
132148 if (!context ) {
133149 return php_stream_auto_decide_error_store_mode (error_mode );
@@ -386,7 +402,7 @@ static void php_stream_throw_exception_with_errors(php_stream_error_operation *o
386402}
387403
388404static void php_stream_report_errors (php_stream_context * context , php_stream_error_operation * op ,
389- int error_mode , bool is_terminating )
405+ php_stream_error_mode error_mode , bool is_terminating )
390406{
391407 switch (error_mode ) {
392408 case PHP_STREAM_ERROR_MODE_ERROR : {
@@ -439,8 +455,8 @@ PHPAPI void php_stream_error_operation_end(php_stream_context *context)
439455 context = FG (default_context );
440456 }
441457
442- int error_mode = php_stream_get_error_mode (context );
443- int store_mode = php_stream_get_error_store_mode (context , error_mode );
458+ php_stream_error_mode error_mode = php_stream_get_error_mode (context );
459+ php_stream_error_store store_mode = php_stream_get_error_store_mode (context , error_mode );
444460
445461 bool is_terminating = php_stream_has_terminating_error (op );
446462
0 commit comments