[php-src] master: [`%pS` migration] Use `%pS` in ext/spl/spl_directory.c

From: Date: Sat, 24 Oct 2026 03:34:57 +0000
Subject: [php-src] master: [`%pS` migration] Use `%pS` in ext/spl/spl_directory.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142652@lists.php.net to get a copy of this message
Author: Daniel Scherzer (DanielEScherzer) Date: 2026-10-23T19:38:22-07:00 Commit: https://github.com/php/php-src/commit/1c6ed5db7ef07989b896ae540b07eb8c7b826193 Raw diff: https://github.com/php/php-src/commit/1c6ed5db7ef07989b896ae540b07eb8c7b826193.diff [%pS migration] Use %pS in ext/spl/spl_directory.c Changed paths: M ext/spl/spl_directory.c Diff: diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 16571158610d..c5dc56d41c09 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -302,7 +302,7 @@ static void spl_filesystem_dir_open(spl_filesystem_object* intern, zend_string * if (!EG(exception)) { /* open failed w/out notice (turned to exception due to EH_THROW) */ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, - "Failed to open directory \"%s\"", ZSTR_VAL(path)); + "Failed to open directory \"%pS\"", path); } } else { do { @@ -333,7 +333,7 @@ static zend_result spl_filesystem_file_open(spl_filesystem_object *intern, bool if (!ZSTR_LEN(intern->file_name) || !intern->u.file.stream) { if (!EG(exception)) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Cannot open file '%s'", ZSTR_VAL(intern->file_name)); + zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Cannot open file '%pS'", intern->file_name); } zend_string_release(intern->u.file.open_mode); intern->u.file.open_mode = NULL; @@ -709,7 +709,7 @@ static void spl_filesystem_object_construct(INTERNAL_FUNCTION_PARAMETERS, zend_l /* spl_filesystem_dir_open() may emit an E_WARNING */ zend_replace_error_handling(EH_THROW, spl_ce_UnexpectedValueException, &error_handling); if (SPL_HAS_FLAG(ctor_flags, DIT_CTOR_GLOB) && !zend_string_starts_with_literal(path, "glob://")) { - path = zend_strpprintf(0, "glob://%s", ZSTR_VAL(path)); + path = zend_strpprintf(0, "glob://%pS", path); spl_filesystem_dir_open(intern, path); zend_string_release(path); } else { @@ -1207,7 +1207,7 @@ PHP_METHOD(SplFileInfo, getLinkTarget) #endif if (ret == -1) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Unable to read link %s, error: %s", ZSTR_VAL(intern->file_name), strerror(errno)); + zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Unable to read link %pS, error: %s", intern->file_name, strerror(errno)); RETVAL_FALSE; } else { /* Append NULL to the end of the string */ @@ -1318,7 +1318,7 @@ PHP_METHOD(SplFileInfo, getPathInfo) if (ce == NULL) { ce = intern->info_class; } else if (!instanceof_function(ce, spl_ce_SplFileInfo)) { - zend_argument_type_error(1, "must be a class name derived from %s or null, %s given", ZSTR_VAL(spl_ce_SplFileInfo->name), ZSTR_VAL(ce->name)); + zend_argument_type_error(1, "must be a class name derived from %pS or null, %pS given", spl_ce_SplFileInfo->name, ce->name); RETURN_THROWS(); } @@ -1503,7 +1503,7 @@ PHP_METHOD(RecursiveDirectoryIterator, getSubPathname) ZEND_PARSE_PARAMETERS_NONE(); if (intern->u.dir.sub_path) { - RETURN_NEW_STR(strpprintf(0, "%s%c%s", ZSTR_VAL(intern->u.dir.sub_path), slash, intern->u.dir.entry.d_name)); + RETURN_NEW_STR(strpprintf(0, "%pS%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name)); } else { RETURN_STRING(intern->u.dir.entry.d_name); } @@ -1776,7 +1776,7 @@ static zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry * static ZEND_COLD void spl_filesystem_file_cannot_read(spl_filesystem_object *intern) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Cannot read from file %s", ZSTR_VAL(intern->file_name)); + zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Cannot read from file %pS", intern->file_name); } static zend_result spl_filesystem_file_read_ex(spl_filesystem_object *intern, bool silent, zend_long line_add, bool csv) @@ -1904,8 +1904,8 @@ static zend_result spl_filesystem_file_read_line_ex(zval * this_ptr, spl_filesys } if (Z_TYPE(retval) != IS_STRING) { - zend_type_error("%s::getCurrentLine(): Return value must be of type string, %s returned", - ZSTR_VAL(Z_OBJCE_P(this_ptr)->name), zend_zval_value_name(&retval)); + zend_type_error("%pS::getCurrentLine(): Return value must be of type string, %s returned", + Z_OBJCE_P(this_ptr)->name, zend_zval_value_name(&retval)); zval_ptr_dtor(&retval); return FAILURE; } @@ -1942,7 +1942,7 @@ static void spl_filesystem_file_rewind(zval * this_ptr, spl_filesystem_object *i return; } if (-1 == php_stream_rewind(intern->u.file.stream)) { - zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Cannot rewind file %s", ZSTR_VAL(intern->file_name)); + zend_throw_exception_ex(spl_ce_RuntimeException, 0, "Cannot rewind file %pS", intern->file_name); return; } @@ -2618,7 +2618,7 @@ PHP_METHOD(SplFileObject, ftruncate) if (!php_stream_truncate_supported(intern->u.file.stream)) { - zend_throw_exception_ex(spl_ce_LogicException, 0, "Can't truncate file %s", ZSTR_VAL(intern->file_name)); + zend_throw_exception_ex(spl_ce_LogicException, 0, "Can't truncate file %pS", intern->file_name); RETURN_THROWS(); }

« previous php.cvs (#142652) next »