1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00

ensure we don't try to use an unitialized hash table

This commit is contained in:
Greg Beaver
2008-06-12 18:46:58 +00:00
parent da022874c5
commit 84eb9cc145

View File

@@ -29,7 +29,7 @@ PHAR_FUNC(phar_opendir) /* {{{ */
int filename_len;
zval *zcontext = NULL;
if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
goto skip_phar;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &filename, &filename_len, &zcontext) == FAILURE) {
@@ -97,7 +97,7 @@ PHAR_FUNC(phar_file_get_contents) /* {{{ */
long maxlen = PHP_STREAM_COPY_ALL;
zval *zcontext = NULL;
if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
goto skip_phar;
}
/* Parse arguments */
@@ -222,7 +222,7 @@ PHAR_FUNC(phar_readfile) /* {{{ */
zval *zcontext = NULL;
php_stream *stream;
if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
goto skip_phar;
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|br!", &filename, &filename_len, &use_include_path, &zcontext) == FAILURE) {
@@ -312,7 +312,7 @@ PHAR_FUNC(phar_fopen) /* {{{ */
zval *zcontext = NULL;
php_stream *stream;
if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
/* no need to check, include_path not even specified in fopen/ no active phars */
goto skip_phar;
}
@@ -869,7 +869,7 @@ PHAR_FUNC(phar_is_file) /* {{{ */
char *filename;
int filename_len;
if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
goto skip_phar;
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {
@@ -929,7 +929,7 @@ PHAR_FUNC(phar_is_link) /* {{{ */
char *filename;
int filename_len;
if (!zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
if (!PHAR_GLOBALS->phar_fname_map.arBuckets || !zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map))) {
goto skip_phar;
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s", &filename, &filename_len) == FAILURE) {