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

Fix map() resetting cached object allowing build() to use the updated object #11457

Merged
merged 2 commits into from Nov 23, 2017

Conversation

Projects
None yet
3 participants
@dereuromark
Member

dereuromark commented Nov 23, 2017

map() does not reset internal object cache for this key, and there is no way to tell build() to make a fresh one.

As Travis around dereuromark/cakephp-ide-helper@f3128fe shows, mapping a different type after building has already been done still uses the old object.
Using set() and an actual instance (Type::set('uuid', new UuidType());) works, but I think resetting here is the expected and intuitive behavior after remapping.

With this fix Type::map('uuid', UuidType::class); etc works.

@dereuromark dereuromark added the Defect label Nov 23, 2017

@dereuromark dereuromark added this to the 3.5.7 milestone Nov 23, 2017

@markstory

This comment has been minimized.

Show comment
Hide comment
@markstory

markstory Nov 23, 2017

Member

Is there a way we could capture the changed behavior with a test case?

Member

markstory commented Nov 23, 2017

Is there a way we could capture the changed behavior with a test case?

@codecov-io

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io Nov 23, 2017

Codecov Report

Merging #11457 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11457      +/-   ##
============================================
+ Coverage     93.11%   93.12%   +0.01%     
- Complexity    13008    13012       +4     
============================================
  Files           436      436              
  Lines         33699    33708       +9     
============================================
+ Hits          31378    31392      +14     
+ Misses         2321     2316       -5
Impacted Files Coverage Δ Complexity Δ
src/Database/Type.php 60.6% <100%> (+0.6%) 32 <0> (ø) ⬇️
src/Auth/DigestAuthenticate.php 92.3% <0%> (+0.74%) 36% <0%> (+4%) ⬆️
src/Cache/Engine/FileEngine.php 90.16% <0%> (+1.09%) 73% <0%> (ø) ⬇️
src/Cache/CacheRegistry.php 100% <0%> (+4%) 11% <0%> (ø) ⬇️
src/Cache/CacheEngine.php 93.61% <0%> (+4.25%) 19% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d42b5f...9902994. Read the comment docs.

codecov-io commented Nov 23, 2017

Codecov Report

Merging #11457 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11457      +/-   ##
============================================
+ Coverage     93.11%   93.12%   +0.01%     
- Complexity    13008    13012       +4     
============================================
  Files           436      436              
  Lines         33699    33708       +9     
============================================
+ Hits          31378    31392      +14     
+ Misses         2321     2316       -5
Impacted Files Coverage Δ Complexity Δ
src/Database/Type.php 60.6% <100%> (+0.6%) 32 <0> (ø) ⬇️
src/Auth/DigestAuthenticate.php 92.3% <0%> (+0.74%) 36% <0%> (+4%) ⬆️
src/Cache/Engine/FileEngine.php 90.16% <0%> (+1.09%) 73% <0%> (ø) ⬇️
src/Cache/CacheRegistry.php 100% <0%> (+4%) 11% <0%> (ø) ⬇️
src/Cache/CacheEngine.php 93.61% <0%> (+4.25%) 19% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d42b5f...9902994. Read the comment docs.

@dereuromark

This comment has been minimized.

Show comment
Hide comment
@dereuromark

dereuromark Nov 23, 2017

Member

I added some tests, and cleaned up the smell about the inline class in the process :)

Member

dereuromark commented Nov 23, 2017

I added some tests, and cleaned up the smell about the inline class in the process :)

@markstory markstory merged commit 5a76d37 into master Nov 23, 2017

6 checks passed

codecov/patch 100% of diff hit (target 93.11%)
Details
codecov/project 93.12% (+0.01%) compared to 6d42b5f
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
stickler-ci No lint errors found.

@markstory markstory deleted the bugfix/type-map branch Nov 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment