@@ -312,8 +312,7 @@ static void read_uriparser_userinfo(INTERNAL_FUNCTION_PARAMETERS, uri_component_
312
312
URI_ASSERT_INITIALIZATION (internal_uri );
313
313
314
314
if (UNEXPECTED (uriparser_read_userinfo (internal_uri , read_mode , return_value ) == FAILURE )) {
315
- zend_throw_error (NULL , "%s::$%s property cannot be retrieved" , ZSTR_VAL (Z_OBJ_P (ZEND_THIS )-> ce -> name ),
316
- ZSTR_VAL (ZSTR_KNOWN (ZEND_STR_USERINFO )));
315
+ zend_throw_error (NULL , "The userinfo component cannot be retrieved" );
317
316
RETURN_THROWS ();
318
317
}
319
318
}
@@ -393,6 +392,11 @@ PHP_METHOD(Uri_Rfc3986_Uri, getRawFragment)
393
392
uri_read_component (INTERNAL_FUNCTION_PARAM_PASSTHRU , URI_PROPERTY_NAME_FRAGMENT , URI_COMPONENT_READ_RAW );
394
393
}
395
394
395
+ static void throw_cannot_recompose_uri_to_string (zend_object * object )
396
+ {
397
+ zend_throw_exception_ex (NULL , 0 , "Cannot recompose %s to a string" , ZSTR_VAL (object -> ce -> name ));
398
+ }
399
+
396
400
static void uri_equals (INTERNAL_FUNCTION_PARAMETERS , zend_object * that_object , zend_object * comparison_mode )
397
401
{
398
402
zend_object * this_object = Z_OBJ_P (ZEND_THIS );
@@ -418,15 +422,15 @@ static void uri_equals(INTERNAL_FUNCTION_PARAMETERS, zend_object *that_object, z
418
422
zend_string * this_str = this_internal_uri -> handler -> uri_to_string (
419
423
this_internal_uri -> uri , URI_RECOMPOSITION_NORMALIZED_ASCII , exclude_fragment );
420
424
if (this_str == NULL ) {
421
- zend_throw_exception_ex ( NULL , 0 , "Cannot recompose %s to string" , ZSTR_VAL ( this_object -> ce -> name ) );
425
+ throw_cannot_recompose_uri_to_string ( this_object );
422
426
RETURN_THROWS ();
423
427
}
424
428
425
429
zend_string * that_str = that_internal_uri -> handler -> uri_to_string (
426
430
that_internal_uri -> uri , URI_RECOMPOSITION_NORMALIZED_ASCII , exclude_fragment );
427
431
if (that_str == NULL ) {
428
432
zend_string_release (this_str );
429
- zend_throw_exception_ex ( NULL , 0 , "Cannot recompose %s to string" , ZSTR_VAL ( that_object -> ce -> name ) );
433
+ throw_cannot_recompose_uri_to_string ( that_object );
430
434
RETURN_THROWS ();
431
435
}
432
436
@@ -460,7 +464,7 @@ PHP_METHOD(Uri_Rfc3986_Uri, toRawString)
460
464
461
465
zend_string * uri_str = internal_uri -> handler -> uri_to_string (internal_uri -> uri , URI_RECOMPOSITION_RAW_ASCII , false);
462
466
if (uri_str == NULL ) {
463
- zend_throw_exception_ex ( NULL , 0 , "Cannot recompose %s to string" , ZSTR_VAL ( this_object -> ce -> name ) );
467
+ throw_cannot_recompose_uri_to_string ( this_object );
464
468
RETURN_THROWS ();
465
469
}
466
470
@@ -477,7 +481,7 @@ PHP_METHOD(Uri_Rfc3986_Uri, toString)
477
481
478
482
zend_string * uri_str = internal_uri -> handler -> uri_to_string (internal_uri -> uri , URI_RECOMPOSITION_NORMALIZED_ASCII , false);
479
483
if (uri_str == NULL ) {
480
- zend_throw_exception_ex ( NULL , 0 , "Cannot recompose %s to string" , ZSTR_VAL ( this_object -> ce -> name ) );
484
+ throw_cannot_recompose_uri_to_string ( this_object );
481
485
RETURN_THROWS ();
482
486
}
483
487
@@ -510,7 +514,7 @@ PHP_METHOD(Uri_Rfc3986_Uri, __serialize)
510
514
/* Serialize state: "uri" key in the first array */
511
515
zend_string * uri_str = internal_uri -> handler -> uri_to_string (internal_uri -> uri , URI_RECOMPOSITION_RAW_ASCII , false);
512
516
if (uri_str == NULL ) {
513
- zend_throw_exception_ex ( NULL , 0 , "Cannot recompose %s to string" , ZSTR_VAL ( this_object -> ce -> name ) );
517
+ throw_cannot_recompose_uri_to_string ( this_object );
514
518
RETURN_THROWS ();
515
519
}
516
520
zval tmp ;
@@ -723,7 +727,7 @@ PHP_METHOD(Uri_WhatWg_Url, __serialize)
723
727
/* Serialize state: "uri" key in the first array */
724
728
zend_string * uri_str = internal_uri -> handler -> uri_to_string (internal_uri -> uri , URI_RECOMPOSITION_RAW_ASCII , false);
725
729
if (uri_str == NULL ) {
726
- zend_throw_exception_ex ( NULL , 0 , "Cannot recompose %s to string" , ZSTR_VAL ( this_object -> ce -> name ) );
730
+ throw_cannot_recompose_uri_to_string ( this_object );
727
731
RETURN_THROWS ();
728
732
}
729
733
zval tmp ;
0 commit comments