Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1259 - Fix unset from class property #2222

Merged
merged 12 commits into from
Apr 24, 2021
Merged

Conversation

Jeckerson
Copy link
Member

@Jeckerson Jeckerson commented Apr 19, 2021

Hello!

  • Type: bug fix

In raising this pull request, I confirm the following:

  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I updated the CHANGELOG

Small description of change:

#define SEPARATE_ZVAL(zv) do {                            
        zval *_zv = (zv);                                
        if (Z_ISREF_P(_zv)) {                            
            zend_reference *_r = Z_REF_P(_zv);            
            ZVAL_COPY_VALUE(_zv, &_r->val);                
            if (GC_DELREF(_r) == 0) {                    
                efree_size(_r, sizeof(zend_reference));    
            } else if (Z_OPT_TYPE_P(_zv) == IS_ARRAY) {    
                ZVAL_ARR(_zv, zend_array_dup(Z_ARR_P(_zv)));
                break;                                    
            } else if (Z_OPT_REFCOUNTED_P(_zv)) {        
                Z_ADDREF_P(_zv);                        
                break;                                    
            }                                            
        }                                                
        if (Z_TYPE_P(_zv) == IS_ARRAY) {                
            SEPARATE_ARRAY(_zv);                        
        }                                                
    } while (0)

Thanks

@Jeckerson Jeckerson added the bug label Apr 19, 2021
@Jeckerson Jeckerson added this to the 0.13.x milestone Apr 19, 2021
@Jeckerson Jeckerson self-assigned this Apr 19, 2021
@Jeckerson Jeckerson linked an issue Apr 19, 2021 that may be closed by this pull request
…F() and SEPARATE_ARRAY()

In PHP8.1 this macro will be removed - php/php-src@ec58a6f
@Jeckerson
Copy link
Member Author

Need to be implemented with zephir_unset_property_array().

@Jeckerson
Copy link
Member Author

zval tmp;
ZVAL_NEW_STR(&tmp, "key_a");
zephir_unset_property_array(this_ptr, ZEND_STRL("unsetData"), &tmp);

@codecov
Copy link

codecov bot commented Apr 24, 2021

Codecov Report

Merging #2222 (cb7a9fc) into development (7dda56b) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

@@               Coverage Diff                @@
##             development   #2222      +/-   ##
================================================
- Coverage           7.68%   7.68%   -0.01%     
- Complexity          8696    8700       +4     
================================================
  Files                355     355              
  Lines              22031   22053      +22     
================================================
  Hits                1694    1694              
- Misses             20337   20359      +22     

@Jeckerson Jeckerson modified the milestones: 0.13.x, 0.13.3 Apr 24, 2021
@Jeckerson Jeckerson marked this pull request as ready for review April 24, 2021 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unset from object property array not working
2 participants