mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
phar: Remove confusing dtor calls (#20148)
If object initialization fails the zval will be NULL, that's an implementation detail. However, it's very confusing for a reader to destroy a seemingly uninitialized zval.
This commit is contained in:
@@ -1730,7 +1730,6 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
}
|
||||
|
||||
if (SUCCESS != object_init_ex(&iter, spl_ce_RecursiveDirectoryIterator)) {
|
||||
zval_ptr_dtor(&iter);
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
|
||||
RETURN_THROWS();
|
||||
}
|
||||
@@ -1748,7 +1747,6 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
|
||||
if (SUCCESS != object_init_ex(&iteriter, spl_ce_RecursiveIteratorIterator)) {
|
||||
zval_ptr_dtor(&iter);
|
||||
zval_ptr_dtor(&iteriter);
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate directory iterator for %s", phar_obj->archive->fname);
|
||||
RETURN_THROWS();
|
||||
}
|
||||
@@ -1769,7 +1767,6 @@ PHP_METHOD(Phar, buildFromDirectory)
|
||||
|
||||
if (SUCCESS != object_init_ex(®exiter, spl_ce_RegexIterator)) {
|
||||
zval_ptr_dtor(&iteriter);
|
||||
zval_ptr_dtor(®exiter);
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate regex iterator for %s", phar_obj->archive->fname);
|
||||
RETURN_THROWS();
|
||||
}
|
||||
@@ -2200,9 +2197,7 @@ its_ok:
|
||||
ce = phar_ce_archive;
|
||||
}
|
||||
|
||||
ZVAL_NULL(&ret);
|
||||
if (SUCCESS != object_init_ex(&ret, ce)) {
|
||||
zval_ptr_dtor(&ret);
|
||||
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Unable to instantiate phar object when converting archive \"%s\"", phar->fname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user