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

Fixed Phalcon\Config::merge being inconsistent #14186

Merged
merged 16 commits into from
Jun 20, 2019

Conversation

CameronHall
Copy link
Contributor

@CameronHall CameronHall commented Jun 18, 2019

Hello!

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines
  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I have updated the relevant CHANGELOG
  • I have created a PR for the documentation about this change

Small description of change:

  • Phalcon/Config now extends Phalcon\Collection\Collection
  • Removed __set_state method
  • Merging is done properly
  • Assignment works as expected all the time

It is worth noting that in #13768 it talks about correctly interpreting integers defined as strings. This is simply not possible given that PHP will cast strings that look like integers to integers.

We also need to maintain our own merge functionality because the native PHP array_merge_recusive will merge values together into an array if they have the same string keys. array_replace_recursive created its own issues whereby it would replace keys with the same numeric index instead of appending to array itself.

Thanks

Removed __set_state method
`Phalcon/Config` now extends `ArrayObject`
Merging is done properly
Assignment works as expected _all_ the time
@CameronHall CameronHall changed the base branch from master to 4.0.x June 18, 2019 16:00
@CameronHall CameronHall changed the title Bugfix/merge typecasted keys Fixed Phalcon\Config::merge being inconsistent Jun 18, 2019
phalcon/Config.zep Outdated Show resolved Hide resolved
Cameron Hall and others added 8 commits June 19, 2019 10:41
How do I keep missing these - CTRL + F >> Static
…ameronHall/cphalcon into bugfix/merge-typecasted-keys

* 'bugfix/merge-typecasted-keys' of github.com:CameronHall/cphalcon:
  Removed set state and fixed segfault
niden
niden previously approved these changes Jun 19, 2019
@codecov
Copy link

codecov bot commented Jun 19, 2019

Codecov Report

Merging #14186 into 4.0.x will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##            4.0.x   #14186      +/-   ##
==========================================
- Coverage   74.75%   74.73%   -0.02%     
==========================================
  Files         455      454       -1     
  Lines       94463    94193     -270     
==========================================
- Hits        70615    70396     -219     
+ Misses      23848    23797      -51
Impacted Files Coverage Δ
ext/phalcon/config/adapter/ini.zep.c 89.1% <0%> (+0.84%) ⬆️
ext/phalcon/config/adapter/yaml.zep.c 72.58% <0%> (+3.22%) ⬆️
ext/phalcon/config/adapter/grouped.zep.c 95.65% <0%> (+6.76%) ⬆️
ext/phalcon/config/configfactory.zep.c 99.42% <0%> (+22.72%) ⬆️

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 b69fed7...b9e2891. Read the comment docs.

niden
niden previously approved these changes Jun 19, 2019
@niden
Copy link
Member

niden commented Jun 19, 2019

This is solid. Will wait for @sergeyklay to give us any ideas on why the windows build fails. If something is wrong and we cannot fix it immediately we can always extend the Collection class vs. the ArrayObject

sergeyklay
sergeyklay previously approved these changes Jun 19, 2019
Copy link
Contributor

@sergeyklay sergeyklay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@niden niden dismissed stale reviews from sergeyklay and themself via 21b19a7 June 20, 2019 02:48
@niden niden added the documentation Documentation required label Jun 20, 2019
niden
niden previously approved these changes Jun 20, 2019
@niden niden merged commit cacb317 into phalcon:4.0.x Jun 20, 2019
@niden
Copy link
Member

niden commented Jun 20, 2019

Thank you @CameronHall

@CameronHall CameronHall mentioned this pull request Jun 28, 2019
@niden niden added 4.0 and removed documentation Documentation required labels Oct 17, 2019
@CameronHall CameronHall deleted the bugfix/merge-typecasted-keys branch October 24, 2019 11:36
@niden niden added bug A bug report status: low Low and removed Bug - Low labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: low Low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants