From 36e191f2b9a0138dcc5551f5b8cc92a2faf30e73 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 5 May 2024 21:11:19 +0200 Subject: [PATCH] Improve error message in Phar::buildFromIterator() --- ext/phar/phar_object.c | 2 +- ext/phar/tests/phar_buildfromiterator5.phpt | 2 +- ext/phar/tests/tar/phar_buildfromiterator5.phpt | 2 +- ext/phar/tests/zip/phar_buildfromiterator5.phpt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 2225d21d187a9..1da17b247b246 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1500,7 +1500,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ } ZEND_FALLTHROUGH; default: - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid value (must return a string)", ZSTR_VAL(ce->name)); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid value (must return a string, a stream, or an SplFileInfo object)", ZSTR_VAL(ce->name)); return ZEND_HASH_APPLY_STOP; } diff --git a/ext/phar/tests/phar_buildfromiterator5.phpt b/ext/phar/tests/phar_buildfromiterator5.phpt index 1e937fe4e8dd2..2ddf1c282ecef 100644 --- a/ext/phar/tests/phar_buildfromiterator5.phpt +++ b/ext/phar/tests/phar_buildfromiterator5.phpt @@ -49,4 +49,4 @@ rewind valid current %s(24) "UnexpectedValueException" -Iterator myIterator returned an invalid value (must return a string) +Iterator myIterator returned an invalid value (must return a string, a stream, or an SplFileInfo object) diff --git a/ext/phar/tests/tar/phar_buildfromiterator5.phpt b/ext/phar/tests/tar/phar_buildfromiterator5.phpt index 27d9dc323b415..6a81c1df65d26 100644 --- a/ext/phar/tests/tar/phar_buildfromiterator5.phpt +++ b/ext/phar/tests/tar/phar_buildfromiterator5.phpt @@ -49,4 +49,4 @@ rewind valid current %s(24) "UnexpectedValueException" -Iterator myIterator returned an invalid value (must return a string) +Iterator myIterator returned an invalid value (must return a string, a stream, or an SplFileInfo object) diff --git a/ext/phar/tests/zip/phar_buildfromiterator5.phpt b/ext/phar/tests/zip/phar_buildfromiterator5.phpt index fb34f09095483..3c587dfc9c874 100644 --- a/ext/phar/tests/zip/phar_buildfromiterator5.phpt +++ b/ext/phar/tests/zip/phar_buildfromiterator5.phpt @@ -49,4 +49,4 @@ rewind valid current %s(24) "UnexpectedValueException" -Iterator myIterator returned an invalid value (must return a string) +Iterator myIterator returned an invalid value (must return a string, a stream, or an SplFileInfo object)