[php-src] PHP-8.6: [`%pS` migration] Use `%pS` in ext/uri (#23172)
| From: | Daniel Scherzer via GitHub | Date: | Mon, 05 Oct 2026 02:33:13 +0000 |
| Subject: | [php-src] PHP-8.6: [`%pS` migration] Use `%pS` in ext/uri (#23172) | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141938@lists.php.net to get a copy of this message | ||
Author: Daniel Scherzer (DanielEScherzer)
Committer: GitHub (web-flow)
Pusher: DanielEScherzer
Date: 2026-10-04T19:33:11-07:00
Commit: https://github.com/php/php-src/commit/f2c9e03e4ad2add0052ea7860fb8216ede1d776f
Raw diff: https://github.com/php/php-src/commit/f2c9e03e4ad2add0052ea7860fb8216ede1d776f.diff
[
%pS migration] Use %pS in ext/uri (#23172)
Changed paths:
M ext/uri/php_uri.c
M ext/uri/php_uri_common.c
Diff:
diff --git a/ext/uri/php_uri.c b/ext/uri/php_uri.c
index bdf1201e425e..f50022aec81f 100644
--- a/ext/uri/php_uri.c
+++ b/ext/uri/php_uri.c
@@ -358,7 +358,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 2) PHPAPI void php_uri_instantiate_uri(
if (should_update_this_object) {
uri_object = Z_URI_OBJECT_P(ZEND_THIS);
if (uri_object->uri != NULL) {
- zend_throw_error(NULL, "Cannot modify readonly object of class %s",
ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
+ zend_throw_error(NULL, "Cannot modify readonly object of class %pS",
Z_OBJCE_P(ZEND_THIS)->name);
RETURN_THROWS();
}
} else {
@@ -478,7 +478,7 @@ PHP_METHOD(Uri_WhatWg_InvalidUrlException, __construct)
zend_update_property(php_uri_ce_whatwg_invalid_url_exception, Z_OBJ_P(ZEND_THIS),
ZEND_STRL("errors"), &tmp);
} else {
if (!is_list_of_whatwg_validation_errors(Z_ARR_P(errors))) {
- zend_argument_value_error(2, "must be a list of %s",
ZSTR_VAL(php_uri_ce_whatwg_url_validation_error->name));
+ zend_argument_value_error(2, "must be a list of %pS",
php_uri_ce_whatwg_url_validation_error->name);
RETURN_THROWS();
}
@@ -731,7 +731,7 @@ PHP_METHOD(Uri_Rfc3986_Uri, withFragment)
static void throw_cannot_recompose_uri_to_string(php_uri_object *object)
{
- zend_throw_exception_ex(php_uri_ce_error, 0, "Cannot recompose %s to a string",
ZSTR_VAL(object->std.ce->name));
+ zend_throw_exception_ex(php_uri_ce_error, 0, "Cannot recompose %pS to a string",
object->std.ce->name);
}
static void uri_equals(INTERNAL_FUNCTION_PARAMETERS, php_uri_object *that_object,
zend_enum_Uri_UriComparisonMode comparison_mode)
@@ -867,52 +867,52 @@ static void uri_unserialize(INTERNAL_FUNCTION_PARAMETERS)
php_uri_object *uri_object = php_uri_object_from_obj(Z_OBJ_P(ZEND_THIS));
if (uri_object->uri != NULL) {
/* Intentionally throw two exceptions for proper chaining. */
- zend_throw_error(NULL, "Cannot modify readonly object of class %s",
ZSTR_VAL(uri_object->std.ce->name));
- zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object",
ZSTR_VAL(uri_object->std.ce->name));
+ zend_throw_error(NULL, "Cannot modify readonly object of class %pS",
uri_object->std.ce->name);
+ zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %pS object",
uri_object->std.ce->name);
RETURN_THROWS();
}
/* Verify the expected number of elements, this implicitly ensures that no additional elements are
present. */
if (zend_hash_num_elements(data) != 2) {
- zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object",
ZSTR_VAL(uri_object->std.ce->name));
+ zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %pS object",
uri_object->std.ce->name);
RETURN_THROWS();
}
/* Unserialize state: "uri" key in the first array */
zval *arr = zend_hash_index_find(data, 0);
if (arr == NULL || Z_TYPE_P(arr) != IS_ARRAY) {
- zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object",
ZSTR_VAL(uri_object->std.ce->name));
+ zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %pS object",
uri_object->std.ce->name);
RETURN_THROWS();
}
/* Verify the expected number of elements inside the first array, this implicitly ensures that no
additional elements are present. */
if (zend_hash_num_elements(Z_ARRVAL_P(arr)) != 1) {
- zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object",
ZSTR_VAL(uri_object->std.ce->name));
+ zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %pS object",
uri_object->std.ce->name);
RETURN_THROWS();
}
zval *uri_zv = zend_hash_str_find(Z_ARRVAL_P(arr), ZEND_STRL(PHP_URI_SERIALIZE_URI_FIELD_NAME));
if (uri_zv == NULL || Z_TYPE_P(uri_zv) != IS_STRING) {
- zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object",
ZSTR_VAL(uri_object->std.ce->name));
+ zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %pS object",
uri_object->std.ce->name);
RETURN_THROWS();
}
uri_object->uri = uri_object->parser->parse(Z_STRVAL_P(uri_zv), Z_STRLEN_P(uri_zv), NULL,
NULL, true);
if (uri_object->uri == NULL) {
- zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object",
ZSTR_VAL(uri_object->std.ce->name));
+ zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %pS object",
uri_object->std.ce->name);
RETURN_THROWS();
}
/* Unserialize regular properties: second array */
arr = zend_hash_index_find(data, 1);
if (arr == NULL || Z_TYPE_P(arr) != IS_ARRAY) {
- zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object",
ZSTR_VAL(uri_object->std.ce->name));
+ zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %pS object",
uri_object->std.ce->name);
RETURN_THROWS();
}
/* Verify that there is no regular property in the second array, because the URI classes have no
properties and they are final. */
if (zend_hash_num_elements(Z_ARRVAL_P(arr)) > 0) {
- zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %s object",
ZSTR_VAL(uri_object->std.ce->name));
+ zend_throw_exception_ex(NULL, 0, "Invalid serialization data for %pS object",
uri_object->std.ce->name);
RETURN_THROWS();
}
}
diff --git a/ext/uri/php_uri_common.c b/ext/uri/php_uri_common.c
index e4850d8059ee..bee17986ca8a 100644
--- a/ext/uri/php_uri_common.c
+++ b/ext/uri/php_uri_common.c
@@ -75,7 +75,7 @@ void php_uri_property_read_helper(INTERNAL_FUNCTION_PARAMETERS, php_uri_property
const php_uri_property_handler *property_handler =
php_uri_parser_property_handler_by_name(uri_object->parser, property_name);
if (UNEXPECTED(property_handler->read(uri_object->uri, component_read_mode, return_value) ==
FAILURE)) {
- zend_throw_exception_ex(php_uri_ce_error, 0, "The %s component cannot be retrieved",
ZSTR_VAL(get_known_string_by_property_name(property_name)));
+ zend_throw_exception_ex(php_uri_ce_error, 0, "The %pS component cannot be retrieved",
get_known_string_by_property_name(property_name));
RETURN_THROWS();
}
}