diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index b9082a9885..c47eb143ca 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -12,6 +12,7 @@ - Fixed `Phalcon\Db\Adapter\Pdo\Postgresql::describeColumns()` to return the correct string back [#16371](https://github.com/phalcon/cphalcon/issues/16371) - Fixed `Phalcon/Filter/Validation::validate()` and `Phalcon/Filter/Validation/ValidationInterface::validate()` to return also `bool` [#16337](https://github.com/phalcon/cphalcon/issues/16337) +- Fixed `Phalcon\Mvc\Model::toArray` to ignore getters when the field name is `source`. [#16514](https://github.com/phalcon/cphalcon/issues/16514) ### Removed diff --git a/phalcon/Cache/AbstractCache.zep b/phalcon/Cache/AbstractCache.zep index 53c8a3ac5a..06cd30a711 100644 --- a/phalcon/Cache/AbstractCache.zep +++ b/phalcon/Cache/AbstractCache.zep @@ -144,7 +144,7 @@ abstract class AbstractCache implements CacheInterface * @throws InvalidArgumentException MUST be thrown if the $key string is * not a legal value. */ - protected function doGet(string key, var defaultValue = null) + protected function doGet(string key, var defaultValue = null) -> var { this->checkKey(key); @@ -154,7 +154,7 @@ abstract class AbstractCache implements CacheInterface /** * Obtains multiple cache items by their unique keys. */ - protected function doGetMultiple(var keys, var defaultValue = null) + protected function doGetMultiple(var keys, var defaultValue = null) -> array { var element, results; diff --git a/phalcon/Mvc/Model.zep b/phalcon/Mvc/Model.zep index c0532165cf..9276217bcd 100644 --- a/phalcon/Mvc/Model.zep +++ b/phalcon/Mvc/Model.zep @@ -3328,7 +3328,10 @@ abstract class Model extends AbstractInjectionAware implements EntityInterface, */ let method = "get" . camelize(attributeField); - if true === useGetter && method_exists(this, method) { + /** + * Do not use the getter if the field name is `source` (getSource) + */ + if true === useGetter && "getSource" !== method && method_exists(this, method) { let data[attributeField] = this->{method}(); } elseif isset(this->{attributeField}) { let data[attributeField] = this->{attributeField};