Skip to content

Commit

Permalink
PHP 8.1 compatibility fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivantcholakov committed Aug 27, 2022
1 parent 56a7eac commit 1fe21a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion platform/common/core/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ function html_attr_remove_class($attributes, $class, $return_as_array = false) {

$attr->removeClass($class);

if (trim($attr->getAttribute('class')) == '') {
if (trim((string) $attr->getAttribute('class')) == '') {
$attr->removeAttribute('class');
}

Expand Down
16 changes: 8 additions & 8 deletions platform/common/core/Core_Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ public function update($primary_value, $data, $skip_validation = FALSE, $escape
->set($data, '', $escape);

// See http://www.sqlite.org/compile.html#enable_update_delete_limit
if (strpos($this->_dbdriver, 'sqlite') === false && strpos($this->_subdriver, 'sqlite') === false) {
if (strpos((string) $this->_dbdriver, 'sqlite') === false && strpos((string) $this->_subdriver, 'sqlite') === false) {
$this->_database->limit(1);
}

Expand Down Expand Up @@ -655,7 +655,7 @@ public function update_by()
$this->_database->set($data, '', $escape);

// See http://www.sqlite.org/compile.html#enable_update_delete_limit
if (strpos($this->_dbdriver, 'sqlite') === false && strpos($this->_subdriver, 'sqlite') === false) {
if (strpos((string) $this->_dbdriver, 'sqlite') === false && strpos((string) $this->_subdriver, 'sqlite') === false) {
$this->_database->limit(1);
}

Expand Down Expand Up @@ -774,7 +774,7 @@ public function delete($id)
if ($this->soft_delete)
{
// See http://www.sqlite.org/compile.html#enable_update_delete_limit
if (strpos($this->_dbdriver, 'sqlite') === false && strpos($this->_subdriver, 'sqlite') === false) {
if (strpos((string) $this->_dbdriver, 'sqlite') === false && strpos((string) $this->_subdriver, 'sqlite') === false) {
$this->_database->limit(1);
}

Expand All @@ -790,7 +790,7 @@ public function delete($id)
else
{
// See http://www.sqlite.org/compile.html#enable_update_delete_limit
if (strpos($this->_dbdriver, 'sqlite') === false && strpos($this->_subdriver, 'sqlite') === false) {
if (strpos((string) $this->_dbdriver, 'sqlite') === false && strpos((string) $this->_subdriver, 'sqlite') === false) {
$this->_database->limit(1);
}

Expand Down Expand Up @@ -824,7 +824,7 @@ public function delete_by()
if ($this->soft_delete)
{
// See http://www.sqlite.org/compile.html#enable_update_delete_limit
if (strpos($this->_dbdriver, 'sqlite') === false && strpos($this->_subdriver, 'sqlite') === false) {
if (strpos((string) $this->_dbdriver, 'sqlite') === false && strpos((string) $this->_subdriver, 'sqlite') === false) {
$this->_database->limit(1);
}

Expand All @@ -841,7 +841,7 @@ public function delete_by()
else
{
// See http://www.sqlite.org/compile.html#enable_update_delete_limit
if (strpos($this->_dbdriver, 'sqlite') === false && strpos($this->_subdriver, 'sqlite') === false) {
if (strpos((string) $this->_dbdriver, 'sqlite') === false && strpos((string) $this->_subdriver, 'sqlite') === false) {
$this->_database->limit(1);
}

Expand Down Expand Up @@ -2220,9 +2220,9 @@ public function trigger($event, $data = FALSE, $last = TRUE)
{
foreach ($this->$event as $method)
{
if (strpos($method, '('))
if (strpos((string) $method, '('))
{
preg_match('/([a-zA-Z0-9\_\-]+)(\(([a-zA-Z0-9\_\-\., ]+)\))?/', $method, $matches);
preg_match('/([a-zA-Z0-9\_\-]+)(\(([a-zA-Z0-9\_\-\., ]+)\))?/', (string) $method, $matches);

$method = $matches[1];
$this->callback_parameters = explode(',', $matches[3]);
Expand Down

0 comments on commit 1fe21a3

Please sign in to comment.