xpdo icon indicating copy to clipboard operation
xpdo copied to clipboard

getService should make sure `$this->{$property}` does not exists/is_null before setting the service reference in

Open rtripault opened this issue 11 years ago • 0 comments

When getting a new service, the service name is also used to define a property on xPDO (see https://github.com/modxcms/xpdo/blob/master/xpdo/xpdo.class.php#L1222).

There should be some upfront check to make sure the property does not exist, or is null to prevent any issue (ie. $xpdo->getService('services', 'ThirdPartyClass', '/path/to/class/) will "override" xPDO->services).

Suggested behavior : log a warning & prevent setting the property (service should still be instantiated & available, just not in xPDO->{$serviceName})

rtripault avatar Oct 03 '14 07:10 rtripault