@@ -87,14 +87,12 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out)
87
87
88
88
if (Z_TYPE_P (val ) == IS_LONG ) {
89
89
if (Z_LVAL_P (val ) < 0 || (zend_ulong )Z_LVAL_P (val ) > UINT_MAX ) {
90
- php_error_docref (NULL , E_WARNING ,
91
- "the interface index cannot be negative or larger than %u;"
92
- " given " ZEND_LONG_FMT , UINT_MAX , Z_LVAL_P (val ));
93
- ret = FAILURE ;
94
- } else {
95
- * out = Z_LVAL_P (val );
96
- ret = SUCCESS ;
90
+ zend_value_error ("The interface index cannot be negative or larger than %u; given " ZEND_LONG_FMT ,
91
+ UINT_MAX , Z_LVAL_P (val ));
92
+ return FAILURE ;
97
93
}
94
+ * out = Z_LVAL_P (val );
95
+ ret = SUCCESS ;
98
96
} else {
99
97
zend_string * tmp_str ;
100
98
zend_string * str = zval_get_tmp_string (val , & tmp_str );
@@ -127,7 +125,7 @@ static int php_get_address_from_array(const HashTable *ht, const char *key,
127
125
zend_string * str , * tmp_str ;
128
126
129
127
if ((val = zend_hash_str_find (ht , key , strlen (key ))) == NULL ) {
130
- php_error_docref ( NULL , E_WARNING , "no key \"%s\" passed in optval" , key );
128
+ zend_value_error ( "No key \"%s\" passed in optval" , key );
131
129
return FAILURE ;
132
130
}
133
131
str = zval_get_tmp_string (val , & tmp_str );
@@ -282,8 +280,7 @@ int php_do_setsockopt_ip_mcast(php_socket *php_sock,
282
280
case IP_MULTICAST_TTL :
283
281
convert_to_long_ex (arg4 );
284
282
if (Z_LVAL_P (arg4 ) < 0L || Z_LVAL_P (arg4 ) > 255L ) {
285
- php_error_docref (NULL , E_WARNING ,
286
- "Expected a value between 0 and 255" );
283
+ zend_value_error ("Expected a value between 0 and 255" );
287
284
return FAILURE ;
288
285
}
289
286
ipv4_mcast_ttl_lback = (unsigned char ) Z_LVAL_P (arg4 );
@@ -347,8 +344,7 @@ int php_do_setsockopt_ipv6_mcast(php_socket *php_sock,
347
344
case IPV6_MULTICAST_HOPS :
348
345
convert_to_long_ex (arg4 );
349
346
if (Z_LVAL_P (arg4 ) < -1L || Z_LVAL_P (arg4 ) > 255L ) {
350
- php_error_docref (NULL , E_WARNING ,
351
- "Expected a value between -1 and 255" );
347
+ zend_value_error ("Expected a value between -1 and 255" );
352
348
return FAILURE ;
353
349
}
354
350
ov = (int ) Z_LVAL_P (arg4 );
@@ -496,8 +492,7 @@ static int _php_mcast_join_leave(
496
492
}
497
493
#endif
498
494
else {
499
- php_error_docref (NULL , E_WARNING ,
500
- "Option %s is inapplicable to this socket type" ,
495
+ zend_value_error ("Option %s is inapplicable to this socket type" ,
501
496
join ? "MCAST_JOIN_GROUP" : "MCAST_LEAVE_GROUP" );
502
497
return -2 ;
503
498
}
0 commit comments