Skip to content

Commit

Permalink
Updated for PHP dynamic property deprecation (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketMan authored Dec 12, 2023
1 parent bdae1a7 commit ee7810a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ https://zookeeper.ibinx.com/master/

### Requirements

* PHP 7.2.5 or later with MySQL PDO driver
* PHP 7.4 or later with MySQL PDO driver
* MySQL/MariaDB

It is recommended to use PHP 8.2 or later, as older versions have
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
]
},
"require": {
"php": ">=7.2.5",
"php": ">=7.4",
"ext-curl": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*",
Expand Down
14 changes: 10 additions & 4 deletions engine/TemplateFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,21 @@ class LazyLoadParams {
];

public $request; // explicit, as we assign by reference later
private $params = [];

public function __isset($name) {
return in_array($name, self::TEMPLATE_SAFE_PARAMS);
return key_exists($name, $this->params) ||
in_array($name, self::TEMPLATE_SAFE_PARAMS);
}

public function __get($name) {
$this->$name = in_array($name, self::TEMPLATE_SAFE_PARAMS) ?
Engine::param($name) : null;
return $this->$name;
return $this->params[$name] ??=
in_array($name, self::TEMPLATE_SAFE_PARAMS) ?
Engine::param($name) : null;
}

public function __set($name, $value) {
$this->params[$name] = $value;
}
}

Expand Down

0 comments on commit ee7810a

Please sign in to comment.