Skip to content

Commit 251d3ba

Browse files
committed
Simplify by chaining
1 parent 8125280 commit 251d3ba

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ext/phar/phar_object.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,10 +1465,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
14651465
phar_call_method_with_unwrap(Z_OBJ_P(value), "getPathname", &rv);
14661466

14671467
if (UNEXPECTED(Z_TYPE(rv) != IS_STRING)) {
1468-
if (!EG(exception)) {
1469-
/* TODO: get rid of this once the return type is no longer tentative */
1470-
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "getPathname() must return a string");
1471-
}
1468+
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "getPathname() must return a string");
14721469
return ZEND_HASH_APPLY_STOP;
14731470
}
14741471
tmp_dir_str = Z_STR(rv);

ext/phar/tests/buildFromIterator_user_overrides/getPathname_exception.phpt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ try {
4141
);
4242
} catch (Throwable $e) {
4343
echo $e->getMessage(), "\n";
44+
if ($previous = $e->getPrevious()) {
45+
echo "Previous: ", $previous->getMessage(), "\n";
46+
}
4447
}
4548
$phar->stopBuffering();
4649

@@ -56,4 +59,5 @@ $workdir = __DIR__.'/003';
5659
[ Found: %shello.txt ]
5760
[getPathname]
5861
string(%d) "%shello.txt"
59-
exception in getPathname()
62+
getPathname() must return a string
63+
Previous: exception in getPathname()

0 commit comments

Comments
 (0)