@@ -312,8 +312,7 @@ static void read_uriparser_userinfo(INTERNAL_FUNCTION_PARAMETERS, uri_component_
312312 URI_ASSERT_INITIALIZATION (internal_uri );
313313
314314 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" );
317316 RETURN_THROWS ();
318317 }
319318}
@@ -393,6 +392,11 @@ PHP_METHOD(Uri_Rfc3986_Uri, getRawFragment)
393392 uri_read_component (INTERNAL_FUNCTION_PARAM_PASSTHRU , URI_PROPERTY_NAME_FRAGMENT , URI_COMPONENT_READ_RAW );
394393}
395394
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+
396400static void uri_equals (INTERNAL_FUNCTION_PARAMETERS , zend_object * that_object , zend_object * comparison_mode )
397401{
398402 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
418422 zend_string * this_str = this_internal_uri -> handler -> uri_to_string (
419423 this_internal_uri -> uri , URI_RECOMPOSITION_NORMALIZED_ASCII , exclude_fragment );
420424 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 );
422426 RETURN_THROWS ();
423427 }
424428
425429 zend_string * that_str = that_internal_uri -> handler -> uri_to_string (
426430 that_internal_uri -> uri , URI_RECOMPOSITION_NORMALIZED_ASCII , exclude_fragment );
427431 if (that_str == NULL ) {
428432 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 );
430434 RETURN_THROWS ();
431435 }
432436
@@ -460,7 +464,7 @@ PHP_METHOD(Uri_Rfc3986_Uri, toRawString)
460464
461465 zend_string * uri_str = internal_uri -> handler -> uri_to_string (internal_uri -> uri , URI_RECOMPOSITION_RAW_ASCII , false);
462466 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 );
464468 RETURN_THROWS ();
465469 }
466470
@@ -477,7 +481,7 @@ PHP_METHOD(Uri_Rfc3986_Uri, toString)
477481
478482 zend_string * uri_str = internal_uri -> handler -> uri_to_string (internal_uri -> uri , URI_RECOMPOSITION_NORMALIZED_ASCII , false);
479483 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 );
481485 RETURN_THROWS ();
482486 }
483487
@@ -510,7 +514,7 @@ PHP_METHOD(Uri_Rfc3986_Uri, __serialize)
510514 /* Serialize state: "uri" key in the first array */
511515 zend_string * uri_str = internal_uri -> handler -> uri_to_string (internal_uri -> uri , URI_RECOMPOSITION_RAW_ASCII , false);
512516 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 );
514518 RETURN_THROWS ();
515519 }
516520 zval tmp ;
@@ -723,7 +727,7 @@ PHP_METHOD(Uri_WhatWg_Url, __serialize)
723727 /* Serialize state: "uri" key in the first array */
724728 zend_string * uri_str = internal_uri -> handler -> uri_to_string (internal_uri -> uri , URI_RECOMPOSITION_RAW_ASCII , false);
725729 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 );
727731 RETURN_THROWS ();
728732 }
729733 zval tmp ;
0 commit comments