@@ -2606,16 +2606,14 @@ PHP_METHOD(Phar, delete)
2606
2606
zend_throw_exception_ex (phar_ce_PharException , 0 , "phar \"%s\" is persistent, unable to copy on write" , phar_obj -> archive -> fname );
2607
2607
RETURN_THROWS ();
2608
2608
}
2609
- if (zend_hash_str_exists (& phar_obj -> archive -> manifest , fname , (uint32_t ) fname_len )) {
2610
- if (NULL != (entry = zend_hash_str_find_ptr (& phar_obj -> archive -> manifest , fname , (uint32_t ) fname_len ))) {
2611
- if (entry -> is_deleted ) {
2612
- /* entry is deleted, but has not been flushed to disk yet */
2613
- RETURN_TRUE ;
2614
- } else {
2615
- entry -> is_deleted = 1 ;
2616
- entry -> is_modified = 1 ;
2617
- phar_obj -> archive -> is_modified = 1 ;
2618
- }
2609
+ if (NULL != (entry = zend_hash_str_find_ptr (& phar_obj -> archive -> manifest , fname , (uint32_t ) fname_len ))) {
2610
+ if (entry -> is_deleted ) {
2611
+ /* entry is deleted, but has not been flushed to disk yet */
2612
+ RETURN_TRUE ;
2613
+ } else {
2614
+ entry -> is_deleted = 1 ;
2615
+ entry -> is_modified = 1 ;
2616
+ phar_obj -> archive -> is_modified = 1 ;
2619
2617
}
2620
2618
} else {
2621
2619
zend_throw_exception_ex (spl_ce_BadMethodCallException , 0 , "Entry %s does not exist and cannot be deleted" , fname );
@@ -3420,18 +3418,16 @@ PHP_METHOD(Phar, copy)
3420
3418
RETURN_THROWS ();
3421
3419
}
3422
3420
3423
- 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 ) {
3421
+ if (NULL == (oldentry = zend_hash_str_find_ptr (& phar_obj -> archive -> manifest , oldfile , (uint32_t ) oldfile_len )) || oldentry -> is_deleted ) {
3424
3422
zend_throw_exception_ex (spl_ce_UnexpectedValueException , 0 ,
3425
3423
"file \"%s\" cannot be copied to file \"%s\", file does not exist in %s" , oldfile , newfile , phar_obj -> archive -> fname );
3426
3424
RETURN_THROWS ();
3427
3425
}
3428
3426
3429
- if (zend_hash_str_exists (& phar_obj -> archive -> manifest , newfile , (uint32_t ) newfile_len )) {
3430
- if (NULL != (temp = zend_hash_str_find_ptr (& phar_obj -> archive -> manifest , newfile , (uint32_t ) newfile_len )) || !temp -> is_deleted ) {
3431
- zend_throw_exception_ex (spl_ce_UnexpectedValueException , 0 ,
3432
- "file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s" , oldfile , newfile , phar_obj -> archive -> fname );
3433
- RETURN_THROWS ();
3434
- }
3427
+ if (NULL != (temp = zend_hash_str_find_ptr (& phar_obj -> archive -> manifest , newfile , (uint32_t ) newfile_len )) && !temp -> is_deleted ) {
3428
+ zend_throw_exception_ex (spl_ce_UnexpectedValueException , 0 ,
3429
+ "file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s" , oldfile , newfile , phar_obj -> archive -> fname );
3430
+ RETURN_THROWS ();
3435
3431
}
3436
3432
3437
3433
tmp_len = newfile_len ;
0 commit comments