mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-03 16:50:13 +00:00
Prevent unintended behavior when certain objects are unserialized.
Props ehtis, xknown. git-svn-id: https://develop.svn.wordpress.org/trunk@56835 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -230,6 +230,21 @@ final class WP_Block_Patterns_Registry {
|
||||
return isset( $this->registered_patterns[ $pattern_name ] );
|
||||
}
|
||||
|
||||
public function __wakeup() {
|
||||
if ( ! $this->registered_patterns ) {
|
||||
return;
|
||||
}
|
||||
if ( ! is_array( $this->registered_patterns ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
foreach ( $this->registered_patterns as $value ) {
|
||||
if ( ! is_array( $value ) ) {
|
||||
throw new UnexpectedValueException();
|
||||
}
|
||||
}
|
||||
$this->registered_patterns_outside_init = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to retrieve the main instance of the class.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user