@@ -225,15 +225,14 @@ zend_string *jwt_b64_url_decode(const char *src)
225225
226226char * jwt_hash_str_find_str (zval * arr , char * key )
227227{
228- char * str = NULL , err_msg [ 128 ] ;
228+ char * str = NULL ;
229229 zval * zv = zend_hash_str_find (Z_ARRVAL_P (arr ), key , strlen (key ));
230230
231231 if (zv != NULL ) {
232232 if (Z_TYPE_P (zv ) == IS_STRING ) {
233233 str = Z_STRVAL_P (zv );
234234 } else {
235- sprintf (err_msg , "%s type must be string" , key );
236- zend_throw_exception (zend_ce_exception , err_msg , 0 );
235+ php_error_docref (NULL , E_WARNING , "%s type must be string" , key );
237236 }
238237 }
239238
@@ -242,15 +241,13 @@ char *jwt_hash_str_find_str(zval *arr, char *key)
242241
243242long jwt_hash_str_find_long (zval * arr , char * key )
244243{
245- char err_msg [128 ];
246244 zval * zv = zend_hash_str_find (Z_ARRVAL_P (arr ), key , strlen (key ));
247245
248246 if (zv != NULL ) {
249247 if (Z_TYPE_P (zv ) == IS_LONG ) {
250248 return Z_LVAL_P (zv );
251249 } else {
252- sprintf (err_msg , "%s type must be long" , key );
253- zend_throw_exception (zend_ce_exception , err_msg , 0 );
250+ php_error_docref (NULL , E_WARNING , "%s type must be long" , key );
254251 }
255252 }
256253
@@ -259,15 +256,13 @@ long jwt_hash_str_find_long(zval *arr, char *key)
259256
260257zend_array * jwt_hash_str_find_ht (zval * arr , char * key )
261258{
262- char err_msg [128 ];
263259 zval * zv = zend_hash_str_find (Z_ARRVAL_P (arr ), key , strlen (key ));
264260
265261 if (zv != NULL ) {
266262 if (Z_TYPE_P (zv ) == IS_ARRAY ) {
267263 return Z_ARRVAL_P (zv );
268264 } else {
269- sprintf (err_msg , "%s type must be array" , key );
270- zend_throw_exception (zend_ce_exception , err_msg , 0 );
265+ php_error_docref (NULL , E_WARNING , "%s type must be array" , key );
271266 }
272267 }
273268
@@ -302,8 +297,7 @@ int jwt_array_equals(zend_array *arr1, zend_array *arr2) {
302297 return FAILURE ;
303298 }
304299 } else {
305- zend_throw_exception (zend_ce_exception , "Aud each item type must be string" , 0 );
306- return FAILURE ;
300+ php_error_docref (NULL , E_WARNING , "Aud each item type must be string" );
307301 }
308302 }
309303 }ZEND_HASH_FOREACH_END ();
0 commit comments