Skip to content

Commit

Permalink
Fix deprecation of dynamic properties (#16440)
Browse files Browse the repository at this point in the history
* Fix deprecation of dynamic properties

Define magic method __set and __get in the class to avoid the deprecation message. See: https://php.watch/versions/8.2/dynamic-properties-deprecated#__get-__set

* Fix 'Cannot assign by reference to overloaded object'

* Use AllowDynamicProperties attribute instead of __get()/__set()

---------

Co-authored-by: Jason Coward <jason@opengeek.com>
  • Loading branch information
Jako and opengeek authored Oct 2, 2023
1 parent d041940 commit 3a885e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/Revolution/Hashing/modHashing.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
* @package MODX\Revolution\Hashing
*/
#[\AllowDynamicProperties]
class modHashing
{
/**
Expand Down Expand Up @@ -104,7 +105,7 @@ public function getHash($key, $class, $options = [])
$hash = new $className($this, $options);
if ($hash instanceof $className) {
$this->_hashes[$key] = $hash;
$this->$key =& $this->_hashes[$key];
$this->$key = $this->_hashes[$key];
}
}
if (array_key_exists($key, $this->_hashes)) {
Expand Down

0 comments on commit 3a885e7

Please sign in to comment.