summaryrefslogtreecommitdiff
path: root/ext/phar
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2011-06-18 22:48:31 +0000
committerFelipe Pena <felipe@php.net>2011-06-18 22:48:31 +0000
commit3964ddd1c4770e24fbada9975986c520c8ce7817 (patch)
tree40d54fdd62bbef2a0414ad7b93810ddf763a02e6 /ext/phar
parente3da6ac3dab89cb85abedc758cfd1c180ec9c3b3 (diff)
downloadphp-git-3964ddd1c4770e24fbada9975986c520c8ce7817.tar.gz
- Added missing void param checks, and fix arginfo
Diffstat (limited to 'ext/phar')
-rw-r--r--ext/phar/phar_object.c124
1 files changed, 122 insertions, 2 deletions
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 69d744b211..06f8bebf18 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -1073,6 +1073,9 @@ PHP_METHOD(Phar, mungServer)
*/
PHP_METHOD(Phar, interceptFileFuncs)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
phar_intercept_functions(TSRMLS_C);
}
/* }}} */
@@ -1150,6 +1153,9 @@ PHP_METHOD(Phar, loadPhar)
* Returns the api version */
PHP_METHOD(Phar, apiVersion)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_STRINGL(PHP_PHAR_API_VERSION, sizeof(PHP_PHAR_API_VERSION)-1, 1);
}
/* }}}*/
@@ -1192,6 +1198,9 @@ PHP_METHOD(Phar, canCompress)
* Returns whether phar extension supports writing and creating phars */
PHP_METHOD(Phar, canWrite)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_BOOL(!PHAR_G(readonly));
}
/* }}} */
@@ -1399,6 +1408,10 @@ PHP_METHOD(Phar, __construct)
*/
PHP_METHOD(Phar, getSupportedSignatures)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
array_init(return_value);
add_next_index_stringl(return_value, "MD5", 3, 1);
@@ -1422,6 +1435,10 @@ PHP_METHOD(Phar, getSupportedSignatures)
*/
PHP_METHOD(Phar, getSupportedCompression)
{
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
array_init(return_value);
phar_request_initialize(TSRMLS_C);
@@ -2085,6 +2102,10 @@ PHP_METHOD(Phar, buildFromIterator)
PHP_METHOD(Phar, count)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_LONG(zend_hash_num_elements(&phar_obj->arc.archive->manifest));
}
@@ -2707,6 +2728,10 @@ PHP_METHOD(Phar, convertToData)
PHP_METHOD(Phar, isCompressed)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (phar_obj->arc.archive->flags & PHAR_FILE_COMPRESSED_GZ) {
RETURN_LONG(PHAR_ENT_COMPRESSED_GZ);
@@ -2727,6 +2752,10 @@ PHP_METHOD(Phar, isWritable)
{
php_stream_statbuf ssb;
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (!phar_obj->arc.archive->is_writeable) {
RETURN_FALSE;
@@ -2801,6 +2830,10 @@ PHP_METHOD(Phar, delete)
PHP_METHOD(Phar, getAlias)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (phar_obj->arc.archive->alias && phar_obj->arc.archive->alias != phar_obj->arc.archive->fname) {
RETURN_STRINGL(phar_obj->arc.archive->alias, phar_obj->arc.archive->alias_len, 1);
@@ -2814,6 +2847,10 @@ PHP_METHOD(Phar, getAlias)
PHP_METHOD(Phar, getPath)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_STRINGL(phar_obj->arc.archive->fname, phar_obj->arc.archive->fname_len, 1);
}
@@ -2926,6 +2963,10 @@ valid_alias:
PHP_METHOD(Phar, getVersion)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_STRING(phar_obj->arc.archive->version, 1);
}
@@ -2937,6 +2978,10 @@ PHP_METHOD(Phar, getVersion)
PHP_METHOD(Phar, startBuffering)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
phar_obj->arc.archive->donotflush = 1;
}
@@ -2948,6 +2993,10 @@ PHP_METHOD(Phar, startBuffering)
PHP_METHOD(Phar, isBuffering)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_BOOL(phar_obj->arc.archive->donotflush);
}
@@ -2961,6 +3010,10 @@ PHP_METHOD(Phar, stopBuffering)
char *error;
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (PHAR_G(readonly) && !phar_obj->arc.archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC,
@@ -3192,6 +3245,10 @@ PHP_METHOD(Phar, setSignatureAlgorithm)
PHP_METHOD(Phar, getSignature)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (phar_obj->arc.archive->signature) {
char *unknown;
@@ -3232,6 +3289,10 @@ PHP_METHOD(Phar, getSignature)
PHP_METHOD(Phar, getModified)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_BOOL(phar_obj->arc.archive->is_modified);
}
@@ -3490,6 +3551,10 @@ PHP_METHOD(Phar, decompressFiles)
{
char *error;
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (PHAR_G(readonly) && !phar_obj->arc.archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
@@ -4007,6 +4072,10 @@ PHP_METHOD(Phar, getStub)
phar_entry_info *stub;
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (phar_obj->arc.archive->is_tar || phar_obj->arc.archive->is_zip) {
@@ -4103,6 +4172,10 @@ PHP_METHOD(Phar, hasMetadata)
PHP_METHOD(Phar, getMetadata)
{
PHAR_ARCHIVE_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (phar_obj->arc.archive->metadata) {
if (phar_obj->arc.archive->is_persistent) {
@@ -4594,6 +4667,10 @@ PHP_METHOD(PharFileInfo, __destruct)
PHP_METHOD(PharFileInfo, getCompressedSize)
{
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_LONG(entry_obj->ent.entry->compressed_filesize);
}
@@ -4632,6 +4709,10 @@ PHP_METHOD(PharFileInfo, isCompressed)
PHP_METHOD(PharFileInfo, getCRC32)
{
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (entry_obj->ent.entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
@@ -4654,6 +4735,10 @@ PHP_METHOD(PharFileInfo, getCRC32)
PHP_METHOD(PharFileInfo, isCRCChecked)
{
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_BOOL(entry_obj->ent.entry->is_crc_checked);
}
@@ -4665,6 +4750,10 @@ PHP_METHOD(PharFileInfo, isCRCChecked)
PHP_METHOD(PharFileInfo, getPharFlags)
{
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_LONG(entry_obj->ent.entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK));
}
@@ -4739,6 +4828,10 @@ PHP_METHOD(PharFileInfo, chmod)
PHP_METHOD(PharFileInfo, hasMetadata)
{
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
RETURN_BOOL(entry_obj->ent.entry->metadata != NULL);
}
@@ -4750,6 +4843,10 @@ PHP_METHOD(PharFileInfo, hasMetadata)
PHP_METHOD(PharFileInfo, getMetadata)
{
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (entry_obj->ent.entry->metadata) {
if (entry_obj->ent.entry->is_persistent) {
@@ -4827,6 +4924,10 @@ PHP_METHOD(PharFileInfo, delMetadata)
char *error;
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (PHAR_G(readonly) && !entry_obj->ent.entry->phar->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, "Write operations disabled by the php.ini setting phar.readonly");
@@ -4881,6 +4982,10 @@ PHP_METHOD(PharFileInfo, getContent)
phar_entry_info *link;
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (entry_obj->ent.entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC,
@@ -5055,6 +5160,10 @@ PHP_METHOD(PharFileInfo, decompress)
{
char *error;
PHAR_ENTRY_OBJECT();
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
if (entry_obj->ent.entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \
@@ -5140,6 +5249,17 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_createDS, 0, 0, 0)
ZEND_END_ARG_INFO()
PHAR_ARG_INFO
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_cancompress, 0, 0, 0)
+ ZEND_ARG_INFO(0, method)
+ZEND_END_ARG_INFO()
+
+PHAR_ARG_INFO
+ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_isvalidpharfilename, 0, 0, 1)
+ ZEND_ARG_INFO(0, filename)
+ ZEND_ARG_INFO(0, executable)
+ZEND_END_ARG_INFO()
+
+PHAR_ARG_INFO
ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_loadPhar, 0, 0, 1)
ZEND_ARG_INFO(0, filename)
ZEND_ARG_INFO(0, alias)
@@ -5350,13 +5470,13 @@ zend_function_entry php_archive_methods[] = {
#endif
/* static member functions */
PHP_ME(Phar, apiVersion, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, canCompress, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, canCompress, arginfo_phar_cancompress, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_ME(Phar, canWrite, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_ME(Phar, createDefaultStub, arginfo_phar_createDS, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_ME(Phar, getSupportedCompression,arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_ME(Phar, getSupportedSignatures,arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_ME(Phar, interceptFileFuncs, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
- PHP_ME(Phar, isValidPharFilename, arginfo_phar__void, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
+ PHP_ME(Phar, isValidPharFilename, arginfo_phar_isvalidpharfilename, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_ME(Phar, loadPhar, arginfo_phar_loadPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_ME(Phar, mapPhar, arginfo_phar_mapPhar, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
PHP_ME(Phar, running, arginfo_phar_running, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)