@@ -83,7 +83,7 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */
83
83
zend_string * ret , * buffer ;
84
84
85
85
if (length > (INT_MAX / 3 )) {
86
- php_error_docref ( NULL , E_WARNING , "Length is too large to safely generate" );
86
+ zend_value_error ( "Length is too large to safely generate" );
87
87
return NULL ;
88
88
}
89
89
@@ -193,7 +193,7 @@ static zend_string* php_password_bcrypt_hash(const zend_string *password, zend_a
193
193
}
194
194
195
195
if (cost < 4 || cost > 31 ) {
196
- php_error_docref ( NULL , E_WARNING , "Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT , cost );
196
+ zend_value_error ( "Invalid bcrypt cost parameter specified: " ZEND_LONG_FMT , cost );
197
197
return NULL ;
198
198
}
199
199
@@ -316,7 +316,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
316
316
}
317
317
318
318
if (memory_cost > ARGON2_MAX_MEMORY || memory_cost < ARGON2_MIN_MEMORY ) {
319
- php_error_docref ( NULL , E_WARNING , "Memory cost is outside of allowed memory range" );
319
+ zend_value_error ( "Memory cost is outside of allowed memory range" );
320
320
return NULL ;
321
321
}
322
322
@@ -325,7 +325,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
325
325
}
326
326
327
327
if (time_cost > ARGON2_MAX_TIME || time_cost < ARGON2_MIN_TIME ) {
328
- php_error_docref ( NULL , E_WARNING , "Time cost is outside of allowed time range" );
328
+ zend_value_error ( "Time cost is outside of allowed time range" );
329
329
return NULL ;
330
330
}
331
331
@@ -334,7 +334,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
334
334
}
335
335
336
336
if (threads > ARGON2_MAX_LANES || threads == 0 ) {
337
- php_error_docref ( NULL , E_WARNING , "Invalid number of threads" );
337
+ zend_value_error ( "Invalid number of threads" );
338
338
return NULL ;
339
339
}
340
340
@@ -669,9 +669,9 @@ PHP_FUNCTION(password_hash)
669
669
algo = php_password_algo_find_zval (zalgo );
670
670
if (!algo ) {
671
671
zend_string * algostr = zval_get_string (zalgo );
672
- php_error_docref ( NULL , E_WARNING , "Unknown password hashing algorithm: %s" , ZSTR_VAL (algostr ));
672
+ zend_value_error ( "Unknown password hashing algorithm: %s" , ZSTR_VAL (algostr ));
673
673
zend_string_release (algostr );
674
- RETURN_NULL () ;
674
+ return ;
675
675
}
676
676
677
677
digest = algo -> hash (password , options );
0 commit comments