Skip to content

Commit

Permalink
Merge pull request #16499 from niden/T16498-model-toarray-segfault
Browse files Browse the repository at this point in the history
reworking the toarray conditionals
  • Loading branch information
niden authored Jan 9, 2024
2 parents 9bb774a + 379040f commit d9be887
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions phalcon/Mvc/Model.zep
Original file line number Diff line number Diff line change
Expand Up @@ -3284,7 +3284,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface,
*/
public function toArray(columns = null, useGetter = true) -> array
{
var attribute, attributeField, columnMap, metaData, method, value;
var attribute, attributeField, columnMap, metaData, method;
array data;

let data = [],
Expand Down Expand Up @@ -3330,8 +3330,8 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface,

if true === useGetter && method_exists(this, method) {
let data[attributeField] = this->{method}();
} elseif fetch value, this->{attributeField} {
let data[attributeField] = value;
} elseif isset(this->{attributeField}) {
let data[attributeField] = this->{attributeField};
} else {
let data[attributeField] = null;
}
Expand Down

0 comments on commit d9be887

Please sign in to comment.