Skip to content

Commit

Permalink
Ignore unknown properties in BugData::__set()
Browse files Browse the repository at this point in the history
Avoids PHP 8.2 "Creation of dynamic property" deprecation warnings
in Roadmap and Changelog pages.

Fixes #34106
  • Loading branch information
dregad committed Mar 16, 2024
1 parent 5e08259 commit 1cd2580
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core/bug_api.php
Expand Up @@ -320,7 +320,9 @@ public function get_bugnotes_count() {
}

/**
* Overloaded Function handling property sets
* Overloaded Function handling property sets.
*
* Unknown properties will be ignored.
*
* @param string $p_name Property name.
* @param string $p_value Value to set.
Expand Down Expand Up @@ -376,6 +378,12 @@ public function __set( $p_name, $p_value ) {
$p_value = db_mysql_fix_utf8( $p_value );
break;

default:
# Silently skip unknown columns
if( !property_exists( $this, $p_name ) ) {
return;
}

}
$this->$p_name = $p_value;
}
Expand Down Expand Up @@ -408,6 +416,9 @@ public function __isset( $p_name ) {
/**
* Fast-load database row into the object.
*
* If the database row contains columns not defined as BugData properties,
* those columns will be ignored.
*
* @param array $p_row Database result to load into a bug object.
*
* @throws ClientException If due_date is not valid
Expand Down

0 comments on commit 1cd2580

Please sign in to comment.