zval arg, arg2, iter, iteriter, regexiter;
struct _phar_t pass;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &dir, &dir_len, ®ex, ®ex_len) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &dir, &dir_len, ®ex, ®ex_len) == FAILURE) {
- RETURN_THROWS();
- }
-
if (ZEND_SIZE_T_UINT_OVFL(dir_len)) {
RETURN_FALSE;
}
char *base = NULL;
struct _phar_t pass;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|s", &obj, zend_ce_traversable, &base, &base_len) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|s", &obj, zend_ce_traversable, &base, &base_len) == FAILURE) {
- RETURN_THROWS();
- }
-
if (ZEND_SIZE_T_UINT_OVFL(base_len)) {
RETURN_FALSE;
}
{
/* mode can be ignored, maximum depth is 1 */
zend_long mode;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &mode) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
RETURN_LONG(zend_hash_num_elements(&phar_obj->archive->manifest));
}
/* }}} */
PHP_METHOD(Phar, isFileFormat)
{
zend_long type;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &type) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
switch (type) {
case PHAR_FORMAT_TAR:
RETURN_BOOL(phar_obj->archive->is_tar);
zend_object *ret;
/* a number that is not 0, 1 or 2 (Which is also Greg's birthday, so there) */
zend_long format = 9021976, method = 9021976;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (PHAR_G(readonly)) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out executable phar archive, phar is read-only");
zend_object *ret;
/* a number that is not 0, 1 or 2 (Which is also Greg's birthday so there) */
zend_long format = 9021976, method = 9021976;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|lls", &format, &method, &ext, &ext_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
switch (format) {
case 9021976:
case PHAR_FORMAT_SAME: /* null is converted to 0 */
*/
PHP_METHOD(Phar, isCompressed)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (phar_obj->archive->flags & PHAR_FILE_COMPRESSED_GZ) {
RETURN_LONG(PHAR_ENT_COMPRESSED_GZ);
}
PHP_METHOD(Phar, isWritable)
{
php_stream_statbuf ssb;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (!phar_obj->archive->is_writeable) {
RETURN_FALSE;
}
size_t fname_len;
char *error;
phar_entry_info *entry;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
- RETURN_THROWS();
- }
-
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
RETURN_THROWS();
/* {{{ Returns the alias for the Phar or NULL. */
PHP_METHOD(Phar, getAlias)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (phar_obj->archive->alias && phar_obj->archive->alias != phar_obj->archive->fname) {
RETURN_STRINGL(phar_obj->archive->alias, phar_obj->archive->alias_len);
}
/* {{{ Returns the real path to the phar archive on disk */
PHP_METHOD(Phar, getPath)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
RETURN_STRINGL(phar_obj->archive->fname, phar_obj->archive->fname_len);
}
/* }}} */
size_t alias_len, oldalias_len;
int old_temp, readd = 0;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &alias, &alias_len) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
/* {{{ Return version info of Phar archive */
PHP_METHOD(Phar, getVersion)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
RETURN_STRING(phar_obj->archive->version);
}
/* }}} */
/* {{{ Do not flush a writeable phar (save its contents) until explicitly requested */
PHP_METHOD(Phar, startBuffering)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
phar_obj->archive->donotflush = 1;
}
/* }}} */
/* {{{ Returns whether write operations are flushing to disk immediately. */
PHP_METHOD(Phar, isBuffering)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
RETURN_BOOL(phar_obj->archive->donotflush);
}
/* }}} */
{
char *error;
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot write out phar archive, phar is read-only");
size_t stub_len;
zend_long len = -1;
php_stream *stream;
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
RETURN_TRUE;
}
- RETURN_FALSE;
+ RETURN_THROWS();
}
/* }}} */
zend_string *stub = NULL;
size_t index_len = 0, webindex_len = 0;
int created_stub = 0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (phar_obj->archive->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
- RETURN_THROWS();
- }
-
if (ZEND_NUM_ARGS() > 0 && (phar_obj->archive->is_tar || phar_obj->archive->is_zip)) {
php_error_docref(NULL, E_WARNING, "Method accepts no arguments for a tar- or zip-based phar stub, %d given", ZEND_NUM_ARGS());
RETURN_FALSE;
char *error, *key = NULL;
size_t key_len = 0;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s", &algo, &key, &key_len) != SUCCESS) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "l|s", &algo, &key, &key_len) != SUCCESS) {
- return;
- }
-
switch (algo) {
case PHAR_SIG_SHA256:
case PHAR_SIG_SHA512:
/* {{{ Returns a hash signature, or FALSE if the archive is unsigned. */
PHP_METHOD(Phar, getSignature)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (phar_obj->archive->signature) {
zend_string *unknown;
/* {{{ Return whether phar was modified */
PHP_METHOD(Phar, getModified)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
RETURN_BOOL(phar_obj->archive->is_modified);
}
/* }}} */
size_t ext_len = 0;
uint32_t flags;
zend_object *ret;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s", &method, &ext, &ext_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot compress phar archive, phar is read-only");
char *ext = NULL;
size_t ext_len = 0;
zend_object *ret;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &ext, &ext_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot decompress phar archive, phar is read-only");
char *error;
uint32_t flags;
zend_long method;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot change compression");
PHP_METHOD(Phar, decompressFiles)
{
char *error;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
+
}
+ PHAR_ARCHIVE_OBJECT();
+
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Phar is readonly, cannot change compression");
phar_entry_info *oldentry, newentry = {0}, *temp;
size_t tmp_len = 0;
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "pp", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
RETURN_THROWS();
}
+
+ PHAR_ARCHIVE_OBJECT();
+
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"Cannot copy \"%s\" to \"%s\", phar is read-only", oldfile, newfile);
size_t fname_len;
phar_entry_info *entry;
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint32_t) fname_len)) {
if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint32_t) fname_len))) {
if (entry->is_deleted) {
zval zfname;
phar_entry_info *entry;
zend_string *sfname;
- PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
/* security is 0 here so that we can get a better error message than "entry doesn't exist" */
if (!(entry = phar_get_entry_info_dir(phar_obj->archive, fname, fname_len, 1, &error, 0))) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist%s%s", fname, error?", ":"", error?error:"");
char *fname, *cont_str = NULL;
size_t fname_len, cont_len;
zval *zresource;
+
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "pr", &fname, &fname_len, &zresource) == FAILURE
+ && zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "pr", &fname, &fname_len, &zresource) == FAILURE
- && zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
- RETURN_THROWS();
- }
if (fname_len == sizeof(".phar/stub.php")-1 && !memcmp(fname, ".phar/stub.php", sizeof(".phar/stub.php")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set stub \".phar/stub.php\" directly in phar \"%s\", use setStub", phar_obj->archive->fname);
RETURN_THROWS();
char *fname, *error;
size_t fname_len;
phar_entry_info *entry;
- PHAR_ARCHIVE_OBJECT();
- if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &fname, &fname_len) == FAILURE) {
+ PHAR_ARCHIVE_OBJECT();
+
+ if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
RETURN_THROWS();
}
char *dirname;
size_t dirname_len;
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p", &dirname, &dirname_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (dirname_len >= sizeof(".phar")-1 && !memcmp(dirname, ".phar", sizeof(".phar")-1)) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot create a directory in magic \".phar\" directory");
RETURN_THROWS();
php_stream *resource;
zval zresource;
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (!strstr(fname, "://") && php_check_open_basedir(fname)) {
zend_throw_exception_ex(spl_ce_RuntimeException, 0, "phar error: unable to open file \"%s\" to add to phar archive, open_basedir restrictions prevent this", fname);
RETURN_THROWS();
char *localname, *cont_str;
size_t localname_len, cont_len;
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ps", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
phar_add_file(&(phar_obj->archive), localname, localname_len, cont_str, cont_len, NULL);
}
/* }}} */
php_stream_filter *filter = NULL;
phar_entry_info *stub;
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
if (phar_obj->archive->is_tar || phar_obj->archive->is_zip) {
if (NULL != (stub = zend_hash_str_find_ptr(&(phar_obj->archive->manifest), ".phar/stub.php", sizeof(".phar/stub.php")-1))) {
/* {{{ Returns TRUE if the phar has global metadata, FALSE otherwise. */
PHP_METHOD(Phar, hasMetadata)
{
- PHAR_ARCHIVE_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ARCHIVE_OBJECT();
+
RETURN_BOOL(phar_metadata_tracker_has_data(&phar_obj->archive->metadata_tracker, phar_obj->archive->is_persistent));
}
/* }}} */
{
HashTable *unserialize_options = NULL;
phar_metadata_tracker *tracker;
- PHAR_ARCHIVE_OBJECT();
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_HT(unserialize_options)
ZEND_PARSE_PARAMETERS_END();
+ PHAR_ARCHIVE_OBJECT();
+
tracker = &phar_obj->archive->metadata_tracker;
if (phar_metadata_tracker_has_data(tracker, phar_obj->archive->is_persistent)) {
phar_metadata_tracker_unserialize_or_copy(tracker, return_value, phar_obj->archive->is_persistent, unserialize_options, "Phar::getMetadata");
char *error;
zval *metadata;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &metadata) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &metadata) == FAILURE) {
- RETURN_THROWS();
- }
-
if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) {
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
RETURN_THROWS();
{
char *error;
+ if (zend_parse_parameters_none() == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ARCHIVE_OBJECT();
if (PHAR_G(readonly) && !phar_obj->archive->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters_none() == FAILURE) {
- RETURN_THROWS();
- }
-
if (!phar_metadata_tracker_has_data(&phar_obj->archive->metadata_tracker, phar_obj->archive->is_persistent)) {
RETURN_TRUE;
}
/* {{{ Returns the compressed size */
PHP_METHOD(PharFileInfo, getCompressedSize)
{
- PHAR_ENTRY_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
RETURN_LONG(entry_obj->entry->compressed_filesize);
}
/* }}} */
{
/* a number that is not Phar::GZ or Phar::BZ2 */
zend_long method = 9021976;
- PHAR_ENTRY_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &method) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
switch (method) {
case 9021976:
RETURN_BOOL(entry_obj->entry->flags & PHAR_ENT_COMPRESSION_MASK);
/* {{{ Returns CRC32 code or throws an exception if not CRC checked */
PHP_METHOD(PharFileInfo, getCRC32)
{
- PHAR_ENTRY_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
if (entry_obj->entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a directory, does not have a CRC"); \
/* {{{ Returns whether file entry is CRC checked */
PHP_METHOD(PharFileInfo, isCRCChecked)
{
- PHAR_ENTRY_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
RETURN_BOOL(entry_obj->entry->is_crc_checked);
}
/* }}} */
/* {{{ Returns the Phar file entry flags */
PHP_METHOD(PharFileInfo, getPharFlags)
{
- PHAR_ENTRY_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
RETURN_LONG(entry_obj->entry->flags & ~(PHAR_ENT_PERM_MASK|PHAR_ENT_COMPRESSION_MASK));
}
/* }}} */
{
char *error;
zend_long perms;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &perms) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ENTRY_OBJECT();
if (entry_obj->entry->is_temp_dir) {
RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &perms) == FAILURE) {
- RETURN_THROWS();
- }
-
if (entry_obj->entry->is_persistent) {
phar_archive_data *phar = entry_obj->entry->phar;
/* {{{ Returns the metadata of the entry */
PHP_METHOD(PharFileInfo, hasMetadata)
{
- PHAR_ENTRY_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
RETURN_BOOL(phar_metadata_tracker_has_data(&entry_obj->entry->metadata_tracker, entry_obj->entry->is_persistent));
}
/* }}} */
{
HashTable *unserialize_options = NULL;
phar_metadata_tracker *tracker;
- PHAR_ENTRY_OBJECT();
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_ARRAY_HT(unserialize_options)
ZEND_PARSE_PARAMETERS_END();
+ PHAR_ENTRY_OBJECT();
+
tracker = &entry_obj->entry->metadata_tracker;
if (phar_metadata_tracker_has_data(tracker, entry_obj->entry->is_persistent)) {
phar_metadata_tracker_unserialize_or_copy(tracker, return_value, entry_obj->entry->is_persistent, unserialize_options, "PharFileInfo::getMetadata");
char *error;
zval *metadata;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &metadata) == FAILURE) {
+ RETURN_THROWS();
+ }
+
PHAR_ENTRY_OBJECT();
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
RETURN_THROWS();
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &metadata) == FAILURE) {
- RETURN_THROWS();
- }
-
if (entry_obj->entry->is_persistent) {
phar_archive_data *phar = entry_obj->entry->phar;
{
char *error;
- PHAR_ENTRY_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
if (PHAR_G(readonly) && !entry_obj->entry->phar->is_data) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Write operations disabled by the php.ini setting phar.readonly");
RETURN_THROWS();
phar_entry_info *link;
zend_string *str;
- PHAR_ENTRY_OBJECT();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
if (entry_obj->entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"phar error: Cannot retrieve contents, \"%s\" in phar \"%s\" is a directory", entry_obj->entry->filename, entry_obj->entry->phar->fname);
{
zend_long method;
char *error;
- PHAR_ENTRY_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &method) == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
if (entry_obj->entry->is_tar) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress with Gzip compression, not possible with tar-based phar archives");
{
char *error;
char *compression_type;
- PHAR_ENTRY_OBJECT();
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ PHAR_ENTRY_OBJECT();
+
if (entry_obj->entry->is_dir) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, \
"Phar entry is a directory, cannot set compression"); \