1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Change impossible condition into assertion

This commit is contained in:
Niels Dossche
2024-12-27 17:34:21 +01:00
committed by GitHub
parent 71dfa931eb
commit accf957727

View File

@@ -1596,13 +1596,12 @@ PHP_METHOD(GlobIterator, count)
RETURN_THROWS(); RETURN_THROWS();
} }
if (spl_intern_is_glob(intern)) { /* The spl_filesystem_object_get_method_check() function is called prior to calling this function.
RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL)); * Therefore, the directory entry cannot be NULL. However, if it is not NULL, then it must be a glob iterator
} else { * by construction. */
/* This can happen by abusing destructors. */ ZEND_ASSERT(spl_intern_is_glob(intern));
/* TODO: relax this from E_ERROR to an exception */
php_error_docref(NULL, E_ERROR, "GlobIterator lost glob state"); RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL));
}
} }
/* }}} */ /* }}} */
#endif /* HAVE_GLOB */ #endif /* HAVE_GLOB */