Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pollution across the objects and array values from VarStrore::class #6

Closed
ReeceM opened this issue Aug 23, 2019 · 1 comment · Fixed by #15
Closed

Pollution across the objects and array values from VarStrore::class #6

ReeceM opened this issue Aug 23, 2019 · 1 comment · Fixed by #15
Labels
bug Something isn't working

Comments

@ReeceM
Copy link
Owner

ReeceM commented Aug 23, 2019

Describe the bug
There is the definite chance that a value set on a different object will be returned when it is retrieved from a different one that doesn't come from the same call

To Reproduce

// assign a value to the mocker object
$mocked->value1->sub_value = 2;

echo $mocked->value1->sub_value . PHP_EOL;
// returns int(2)

// now assign that same sub_value to another object or array
$mocked->assoc_arr['sub_value'] = 'Must be different value';

echo $mocked->assoc_arr['sub_value'];
// returns 2

// but

echo $mocked->sub_value; 
// returns 2

echo $mocked->value1->sub_value; 
// returns 2

Expected behavior
This should not do that and has a problem to do with the flat structure of the VarStore and the way in which the values are resolved.

The VarStore should be structured as the way in which the values should be called i.e.:

// calling 
$mocked->sub_value; // would return 'null' or 'mocked->sub_value';
or
$mocked->value1->sub_value; // gives 2
and 
$mocked->assoc_arr['sub_value']; // will give the string
@ReeceM ReeceM added the bug Something isn't working label Aug 23, 2019
@Qoraiche
Copy link
Contributor

Qoraiche commented Sep 1, 2019

Interesting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants