mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 14:46:19 +08:00 
			
		
		
		
	Fix Model::__clone() (#19291)
				
					
				
			* Fix Model::__clone() Reset validators and errors after cloning to prevent changing cloned model via inner objects of clone like as InlineValidator * Update CHANGELOG.md Co-authored-by: Bizley <pawel@positive.codes>
This commit is contained in:
		@ -6,6 +6,7 @@ Yii Framework 2 Change Log
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
- Bug #19243: Handle `finfo_open` for tar.xz as `application/octet-stream` on PHP 8.1 (longthanhtran)
 | 
					- Bug #19243: Handle `finfo_open` for tar.xz as `application/octet-stream` on PHP 8.1 (longthanhtran)
 | 
				
			||||||
- Bug #19235: Fix return type compatibility of `yii\web\SessionIterator` class methods for PHP 8.1 (virtual-designer)
 | 
					- Bug #19235: Fix return type compatibility of `yii\web\SessionIterator` class methods for PHP 8.1 (virtual-designer)
 | 
				
			||||||
 | 
					- Bug #19291: Reset errors and validators in `yii\base\Model::__clone()` (WinterSilence)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2.0.45 February 11, 2022
 | 
					2.0.45 February 11, 2022
 | 
				
			||||||
 | 
				
			|||||||
@ -1052,4 +1052,15 @@ class Model extends Component implements StaticInstanceInterface, IteratorAggreg
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->$offset = null;
 | 
					        $this->$offset = null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * {@inheritdoc}
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __clone()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        parent::__clone();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->_errors = null;
 | 
				
			||||||
 | 
					        $this->_validators = null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user