diff options
author | Greg Beaver <cellog@php.net> | 2007-08-25 01:33:47 +0000 |
---|---|---|
committer | Greg Beaver <cellog@php.net> | 2007-08-25 01:33:47 +0000 |
commit | 4012b3f94aae6aefe731988a4de52e5d58b4bf22 (patch) | |
tree | bf8e97038598dc956bb7f87172c4119d42ced57a | |
parent | 48e9d0f2999f0ffd40cc95f0bd4a0d27c82679dc (diff) | |
download | php-git-4012b3f94aae6aefe731988a4de52e5d58b4bf22.tar.gz |
add missing read-only check for Phar::setAlias
-rwxr-xr-x | ext/phar/phar_object.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 124c471a87..926aff14bc 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -309,6 +309,12 @@ PHP_METHOD(Phar, setAlias) phar_archive_data *fd, **fd_ptr; int alias_len; PHAR_ARCHIVE_OBJECT(); + + if (PHAR_G(readonly)) { + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, + "Cannot write out phar archive, phar is read-only"); + } + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &alias, &alias_len) == SUCCESS) { if (alias_len == phar_obj->arc.archive->alias_len && memcmp(phar_obj->arc.archive->alias, alias, alias_len) == 0) { RETURN_TRUE; |