up release and fix svace patches

This commit is contained in:
HisShadow 2023-10-09 14:42:55 +03:00
parent e0a57253ce
commit e95f0e7441
2 changed files with 35 additions and 3 deletions

View file

@ -233,7 +233,39 @@ diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index b0de6e4..5e3adec 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -3484,12 +3484,10 @@ PHP_METHOD(Phar, copy)
@@ -2654,16 +2654,14 @@
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
- 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) {
- /* entry is deleted, but has not been flushed to disk yet */
- RETURN_TRUE;
- } else {
- entry->is_deleted = 1;
- entry->is_modified = 1;
- phar_obj->archive->is_modified = 1;
- }
+ if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint32_t) fname_len))) {
+ if (entry->is_deleted) {
+ /* entry is deleted, but has not been flushed to disk yet */
+ RETURN_TRUE;
+ } else {
+ entry->is_deleted = 1;
+ entry->is_modified = 1;
+ phar_obj->archive->is_modified = 1;
}
} else {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist and cannot be deleted", fname);
@@ -3478,18 +3476,16 @@
RETURN_FALSE;
}
- if (!zend_hash_str_exists(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len) || NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len)) || oldentry->is_deleted) {
+ if (NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len)) || oldentry->is_deleted) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", file does not exist in %s", oldfile, newfile, phar_obj->archive->fname);
RETURN_FALSE;
}
@ -243,7 +275,7 @@ index b0de6e4..5e3adec 100644
- "file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s", oldfile, newfile, phar_obj->archive->fname);
- RETURN_FALSE;
- }
+ if (!zend_hash_str_exists(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len) || NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len)) || oldentry->is_deleted) {
+ if (NULL != (temp = zend_hash_str_find_ptr(&phar_obj->archive->manifest, newfile, (uint32_t) newfile_len)) && !temp->is_deleted) {
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
+ "file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s", oldfile, newfile, phar_obj->archive->fname);
+ RETURN_FALSE;

View file

@ -27,7 +27,7 @@
Summary: The PHP7 scripting language
Name: php
Version: 7.4.30
Release: 4
Release: 5
Source0: http://ch1.php.net/distributions/php-%{version}.tar.gz
Source1: macros.php
Group: Development/PHP