Commit 19e86db05ea for php
commit 19e86db05ea318993e3fcc834a3b606e448a07b9
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Sat Aug 8 16:05:44 2026 -0700
[`%pS` migration] Use `%pS` in ext/spl/spl_iterators.c
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 06d344990df..dfcde994a5c 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -524,8 +524,8 @@ static zend_result spl_get_iterator_from_aggregate(zval *retval, zend_class_entr
if (Z_TYPE_P(retval) != IS_OBJECT
|| !instanceof_function(Z_OBJCE_P(retval), zend_ce_traversable)) {
zend_throw_exception_ex(spl_ce_LogicException, 0,
- "%s::getIterator() must return an object that implements Traversable",
- ZSTR_VAL(ce->name));
+ "%pS::getIterator() must return an object that implements Traversable",
+ ce->name);
zval_ptr_dtor(retval);
return FAILURE;
}
@@ -905,7 +905,7 @@ static zend_function *spl_recursive_it_get_method(zend_object **zobject, zend_st
zval *zobj;
if (!object->iterators) {
- zend_throw_error(NULL, "The %s instance wasn't initialized properly", ZSTR_VAL((*zobject)->ce->name));
+ zend_throw_error(NULL, "The %pS instance wasn't initialized properly", (*zobject)->ce->name);
return NULL;
}
zobj = &object->iterators[level].zobject;
@@ -1250,8 +1250,8 @@ static zend_function *spl_dual_it_get_method(zend_object **object, zend_string *
#define SPL_CHECK_CTOR(intern, classname) \
if (intern->dit_type == DIT_Unknown) { \
/* TODO Normal Error? */ \
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Classes derived from %s must call %s::__construct()", \
- ZSTR_VAL((spl_ce_##classname)->name), ZSTR_VAL((spl_ce_##classname)->name)); \
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Classes derived from %pS must call %pS::__construct()", \
+ (spl_ce_##classname)->name, (spl_ce_##classname)->name); \
RETURN_THROWS(); \
}
@@ -1282,7 +1282,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
intern = Z_SPLDUAL_IT_P(ZEND_THIS);
if (intern->dit_type != DIT_Unknown) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s::getIterator() must be called exactly once per instance", ZSTR_VAL(ce_base->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS::getIterator() must be called exactly once per instance", ce_base->name);
return NULL;
}
@@ -2402,7 +2402,7 @@ PHP_METHOD(CachingIterator, __toString)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (!(intern->u.caching.flags & (CIT_CALL_TOSTRING|CIT_TOSTRING_USE_KEY|CIT_TOSTRING_USE_CURRENT|CIT_TOSTRING_USE_INNER))) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not fetch string value (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS does not fetch string value (see CachingIterator::__construct)", Z_OBJCE_P(ZEND_THIS)->name);
RETURN_THROWS();
}
@@ -2436,7 +2436,7 @@ PHP_METHOD(CachingIterator, offsetSet)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(ZEND_THIS)->name);
RETURN_THROWS();
}
@@ -2459,12 +2459,12 @@ PHP_METHOD(CachingIterator, offsetGet)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(ZEND_THIS)->name);
RETURN_THROWS();
}
if ((value = zend_symtable_find(Z_ARRVAL(intern->u.caching.zcache), key)) == NULL) {
- zend_error(E_WARNING, "Undefined array key \"%s\"", ZSTR_VAL(key));
+ zend_error(E_WARNING, "Undefined array key \"%pS\"", key);
return;
}
@@ -2485,7 +2485,7 @@ PHP_METHOD(CachingIterator, offsetUnset)
}
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(ZEND_THIS)->name);
RETURN_THROWS();
}
@@ -2506,7 +2506,7 @@ PHP_METHOD(CachingIterator, offsetExists)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(ZEND_THIS)->name);
RETURN_THROWS();
}
@@ -2524,7 +2524,7 @@ PHP_METHOD(CachingIterator, getCache)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(ZEND_THIS)->name);
RETURN_THROWS();
}
@@ -2589,7 +2589,7 @@ PHP_METHOD(CachingIterator, count)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, ZEND_THIS);
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS does not use a full cache (see CachingIterator::__construct)", Z_OBJCE_P(ZEND_THIS)->name);
RETURN_THROWS();
}
@@ -2819,7 +2819,7 @@ PHP_METHOD(AppendIterator, __construct)
/* TODO: This should be converted to a normal Error as this is triggered when calling the constructor twice */
if (intern->dit_type != DIT_Unknown) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s::getIterator() must be called exactly once per instance", ZSTR_VAL(spl_ce_AppendIterator->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%pS::getIterator() must be called exactly once per instance", spl_ce_AppendIterator->name);
RETURN_THROWS();
}