Skip to content

Commit d9be887

Browse files
authored
Merge pull request #16499 from niden/T16498-model-toarray-segfault
reworking the toarray conditionals
2 parents 9bb774a + 379040f commit d9be887

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

phalcon/Mvc/Model.zep

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3284,7 +3284,7 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface,
32843284
*/
32853285
public function toArray(columns = null, useGetter = true) -> array
32863286
{
3287-
var attribute, attributeField, columnMap, metaData, method, value;
3287+
var attribute, attributeField, columnMap, metaData, method;
32883288
array data;
32893289

32903290
let data = [],
@@ -3330,8 +3330,8 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface,
33303330

33313331
if true === useGetter && method_exists(this, method) {
33323332
let data[attributeField] = this->{method}();
3333-
} elseif fetch value, this->{attributeField} {
3334-
let data[attributeField] = value;
3333+
} elseif isset(this->{attributeField}) {
3334+
let data[attributeField] = this->{attributeField};
33353335
} else {
33363336
let data[attributeField] = null;
33373337
}

0 commit comments

Comments
 (0)