truonglv
Well-known member
- Affected version
- 2.0.6
When hydrate an relation the entity did not check the conditions so in some cases could make wrong relation.
Eg:
When fetch data from relation B with user_id difference with current visitor so when access A->B could give wrong.
Eg:
Expect: A->B is result of current visitor.
Actual: A->B is return of B record not of the current visitor.
Eg:
PHP:
Class A ...
$structure->relations['B'] = [
'conditions' => [
[...],
['user_id', '=', \XF::visitor()->user_id]
]
];
$structure->defaultWith = ['B'];
PHP:
class B {
...
$structure->relations['A'] = [...];
$structure->defaultWith = ['A'];
}
When fetch data from relation B with user_id difference with current visitor so when access A->B could give wrong.
Eg:
PHP:
$em->findOne('...', [
// other conditions
'user_id' => 2
], '...');
Expect: A->B is result of current visitor.
Actual: A->B is return of B record not of the current visitor.