@@ -383,8 +383,8 @@ PHP_FUNCTION(stream_socket_recvfrom)
383
383
}
384
384
385
385
if (to_read <= 0 ) {
386
- php_error_docref ( NULL , E_WARNING , "Length parameter must be greater than 0" );
387
- RETURN_FALSE ;
386
+ zend_value_error ( "Length parameter must be greater than 0" );
387
+ return ;
388
388
}
389
389
390
390
read_buf = zend_string_alloc (to_read , 0 );
@@ -493,7 +493,7 @@ PHP_FUNCTION(stream_copy_to_stream)
493
493
}
494
494
/* }}} */
495
495
496
- /* {{{ proto array|false stream_get_meta_data(resource fp)
496
+ /* {{{ proto array stream_get_meta_data(resource fp)
497
497
Retrieves header/meta data from streams/file pointers */
498
498
PHP_FUNCTION (stream_get_meta_data )
499
499
{
@@ -784,20 +784,20 @@ PHP_FUNCTION(stream_select)
784
784
}
785
785
786
786
if (!sets ) {
787
- php_error_docref ( NULL , E_WARNING , "No stream arrays were passed" );
788
- RETURN_FALSE ;
787
+ zend_value_error ( "No stream arrays were passed" );
788
+ return ;
789
789
}
790
790
791
791
PHP_SAFE_MAX_FD (max_fd , max_set_count );
792
792
793
793
/* If seconds is not set to null, build the timeval, else we wait indefinitely */
794
794
if (!secnull ) {
795
795
if (sec < 0 ) {
796
- php_error_docref ( NULL , E_WARNING , "The seconds parameter must be greater than 0" );
797
- RETURN_FALSE ;
796
+ zend_value_error ( "The seconds parameter must be greater than 0" );
797
+ return ;
798
798
} else if (usec < 0 ) {
799
- php_error_docref ( NULL , E_WARNING , "The microseconds parameter must be greater than 0" );
800
- RETURN_FALSE ;
799
+ zend_value_error ( "The microseconds parameter must be greater than 0" );
800
+ return ;
801
801
}
802
802
803
803
/* Windows, Solaris and BSD do not like microsecond values which are >= 1 sec */
@@ -827,7 +827,7 @@ PHP_FUNCTION(stream_select)
827
827
retval = php_select (max_fd + 1 , & rfds , & wfds , & efds , tv_p );
828
828
829
829
if (retval == -1 ) {
830
- php_error_docref (NULL , E_WARNING , "unable to select [%d]: %s (max_fd=%d)" ,
830
+ php_error_docref (NULL , E_WARNING , "Unable to select [%d]: %s (max_fd=%d)" ,
831
831
errno , strerror (errno ), max_fd );
832
832
RETURN_FALSE ;
833
833
}
@@ -892,7 +892,8 @@ static int parse_context_options(php_stream_context *context, zval *options)
892
892
}
893
893
} ZEND_HASH_FOREACH_END ();
894
894
} else {
895
- php_error_docref (NULL , E_WARNING , "options should have the form [\"wrappername\"][\"optionname\"] = $value" );
895
+ zend_value_error ("Options should have the form [\"wrappername\"][\"optionname\"] = $value" );
896
+ return FAILURE ;
896
897
}
897
898
} ZEND_HASH_FOREACH_END ();
898
899
@@ -918,9 +919,10 @@ static int parse_context_params(php_stream_context *context, zval *params)
918
919
}
919
920
if (NULL != (tmp = zend_hash_str_find (Z_ARRVAL_P (params ), "options" , sizeof ("options" )- 1 ))) {
920
921
if (Z_TYPE_P (tmp ) == IS_ARRAY ) {
921
- parse_context_options (context , tmp );
922
+ return parse_context_options (context , tmp );
922
923
} else {
923
- php_error_docref (NULL , E_WARNING , "Invalid stream/context parameter" );
924
+ zend_type_error ("Invalid stream/context parameter" );
925
+ return FAILURE ;
924
926
}
925
927
}
926
928
@@ -957,7 +959,7 @@ static php_stream_context *decode_context_param(zval *contextresource)
957
959
}
958
960
/* }}} */
959
961
960
- /* {{{ proto array|false stream_context_get_options(resource context|resource stream)
962
+ /* {{{ proto array stream_context_get_options(resource context|resource stream)
961
963
Retrieve options for a stream/wrapper/context */
962
964
PHP_FUNCTION (stream_context_get_options )
963
965
{
@@ -970,8 +972,8 @@ PHP_FUNCTION(stream_context_get_options)
970
972
971
973
context = decode_context_param (zcontext );
972
974
if (!context ) {
973
- php_error_docref ( NULL , E_WARNING , "Invalid stream/context parameter" );
974
- RETURN_FALSE ;
975
+ zend_type_error ( "Invalid stream/context parameter" );
976
+ return ;
975
977
}
976
978
977
979
ZVAL_COPY (return_value , & context -> options );
@@ -995,8 +997,8 @@ PHP_FUNCTION(stream_context_set_option)
995
997
996
998
/* figure out where the context is coming from exactly */
997
999
if (!(context = decode_context_param (zcontext ))) {
998
- php_error_docref ( NULL , E_WARNING , "Invalid stream/context parameter" );
999
- RETURN_FALSE ;
1000
+ zend_type_error ( "Invalid stream/context parameter" );
1001
+ return ;
1000
1002
}
1001
1003
1002
1004
RETURN_BOOL (parse_context_options (context , options ) == SUCCESS );
@@ -1014,8 +1016,8 @@ PHP_FUNCTION(stream_context_set_option)
1014
1016
1015
1017
/* figure out where the context is coming from exactly */
1016
1018
if (!(context = decode_context_param (zcontext ))) {
1017
- php_error_docref ( NULL , E_WARNING , "Invalid stream/context parameter" );
1018
- RETURN_FALSE ;
1019
+ zend_type_error ( "Invalid stream/context parameter" );
1020
+ return ;
1019
1021
}
1020
1022
1021
1023
RETURN_BOOL (php_stream_context_set_option (context , wrappername , optionname , zvalue ) == SUCCESS );
@@ -1037,15 +1039,15 @@ PHP_FUNCTION(stream_context_set_params)
1037
1039
1038
1040
context = decode_context_param (zcontext );
1039
1041
if (!context ) {
1040
- php_error_docref ( NULL , E_WARNING , "Invalid stream/context parameter" );
1041
- RETURN_FALSE ;
1042
+ zend_type_error ( "Invalid stream/context parameter" );
1043
+ return ;
1042
1044
}
1043
1045
1044
1046
RETVAL_BOOL (parse_context_params (context , params ) == SUCCESS );
1045
1047
}
1046
1048
/* }}} */
1047
1049
1048
- /* {{{ proto array|false stream_context_get_params(resource context|resource stream)
1050
+ /* {{{ proto array stream_context_get_params(resource context|resource stream)
1049
1051
Get parameters of a file context */
1050
1052
PHP_FUNCTION (stream_context_get_params )
1051
1053
{
@@ -1058,8 +1060,8 @@ PHP_FUNCTION(stream_context_get_params)
1058
1060
1059
1061
context = decode_context_param (zcontext );
1060
1062
if (!context ) {
1061
- php_error_docref ( NULL , E_WARNING , "Invalid stream/context parameter" );
1062
- RETURN_FALSE ;
1063
+ zend_type_error ( "Invalid stream/context parameter" );
1064
+ return ;
1063
1065
}
1064
1066
1065
1067
array_init (return_value );
@@ -1090,7 +1092,9 @@ PHP_FUNCTION(stream_context_get_default)
1090
1092
context = FG (default_context );
1091
1093
1092
1094
if (params ) {
1093
- parse_context_options (context , params );
1095
+ if (parse_context_options (context , params ) == FAILURE ) {
1096
+ return ;
1097
+ }
1094
1098
}
1095
1099
1096
1100
php_stream_context_to_zval (context , return_value );
@@ -1113,7 +1117,9 @@ PHP_FUNCTION(stream_context_set_default)
1113
1117
}
1114
1118
context = FG (default_context );
1115
1119
1116
- parse_context_options (context , options );
1120
+ if (parse_context_options (context , options ) == FAILURE ) {
1121
+ return ;
1122
+ }
1117
1123
1118
1124
php_stream_context_to_zval (context , return_value );
1119
1125
}
@@ -1253,10 +1259,9 @@ PHP_FUNCTION(stream_filter_remove)
1253
1259
Z_PARAM_RESOURCE (zfilter )
1254
1260
ZEND_PARSE_PARAMETERS_END ();
1255
1261
1256
- filter = zend_fetch_resource (Z_RES_P (zfilter ), NULL , php_file_le_stream_filter ());
1262
+ filter = zend_fetch_resource (Z_RES_P (zfilter ), "stream filter" , php_file_le_stream_filter ());
1257
1263
if (!filter ) {
1258
- php_error_docref (NULL , E_WARNING , "Invalid resource given, not a stream filter" );
1259
- RETURN_FALSE ;
1264
+ return ;
1260
1265
}
1261
1266
1262
1267
if (php_stream_filter_flush (filter , 1 ) == FAILURE ) {
@@ -1293,8 +1298,8 @@ PHP_FUNCTION(stream_get_line)
1293
1298
ZEND_PARSE_PARAMETERS_END ();
1294
1299
1295
1300
if (max_length < 0 ) {
1296
- php_error_docref ( NULL , E_WARNING , "The maximum allowed length must be greater than or equal to zero" );
1297
- RETURN_FALSE ;
1301
+ zend_value_error ( "The maximum allowed length must be greater than or equal to zero" );
1302
+ return ;
1298
1303
}
1299
1304
if (!max_length ) {
1300
1305
max_length = PHP_SOCK_CHUNK_SIZE ;
@@ -1429,16 +1434,16 @@ PHP_FUNCTION(stream_set_chunk_size)
1429
1434
ZEND_PARSE_PARAMETERS_END ();
1430
1435
1431
1436
if (csize <= 0 ) {
1432
- php_error_docref ( NULL , E_WARNING , "The chunk size must be a positive integer, given " ZEND_LONG_FMT , csize );
1433
- RETURN_FALSE ;
1437
+ zend_value_error ( "The chunk size must be a positive integer, " ZEND_LONG_FMT " given" , csize );
1438
+ return ;
1434
1439
}
1435
1440
/* stream.chunk_size is actually a size_t, but php_stream_set_option
1436
1441
* can only use an int to accept the new value and return the old one.
1437
1442
* In any case, values larger than INT_MAX for a chunk size make no sense.
1438
1443
*/
1439
1444
if (csize > INT_MAX ) {
1440
- php_error_docref ( NULL , E_WARNING , "The chunk size cannot be larger than %d" , INT_MAX );
1441
- RETURN_FALSE ;
1445
+ zend_value_error ( "The chunk size cannot be larger than %d" , INT_MAX );
1446
+ return ;
1442
1447
}
1443
1448
1444
1449
php_stream_from_zval (stream , zstream );
@@ -1504,8 +1509,8 @@ PHP_FUNCTION(stream_socket_enable_crypto)
1504
1509
zval * val ;
1505
1510
1506
1511
if (!GET_CTX_OPT (stream , "ssl" , "crypto_method" , val )) {
1507
- php_error_docref ( NULL , E_WARNING , "When enabling encryption you must specify the crypto type" );
1508
- RETURN_FALSE ;
1512
+ zend_value_error ( "When enabling encryption you must specify the crypto type" );
1513
+ return ;
1509
1514
}
1510
1515
1511
1516
cryptokind = Z_LVAL_P (val );
@@ -1679,7 +1684,7 @@ PHP_FUNCTION(sapi_windows_vt100_support)
1679
1684
"%s() was not able to analyze the specified stream" ,
1680
1685
get_active_function_name ()
1681
1686
);
1682
- RETURN_FALSE ;
1687
+ return ;
1683
1688
}
1684
1689
1685
1690
/* Check if the file descriptor is a console */
0 commit comments