Merge branch 'rosa2023.1' into rosa2021.1

This commit is contained in:
Mikhail Novosyolov 2023-10-11 14:33:04 +03:00
commit 610f1e8033
2 changed files with 38 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.33
Release: 1
Release: 2
Source0: http://ch1.php.net/distributions/php-%{version}.tar.gz
Source1: macros.php
Group: Development/PHP
@ -1276,7 +1276,10 @@ fi
%patch122 -p1
%patch127 -p1
%ifarch %{e2k}
%patch200 -p1
%endif
cp %{SOURCE2} maxlifetime
cp %{SOURCE3} php.crond