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

Config file custom sections parse with false keys #1149

Closed
vinser opened this issue Apr 7, 2019 · 4 comments
Closed

Config file custom sections parse with false keys #1149

vinser opened this issue Apr 7, 2019 · 4 comments
Labels

Comments

@vinser
Copy link

vinser commented Apr 7, 2019

Hi!
There are false keys with NULLs in hive after parsing config file with custom section:
Config file:

; Colour themes
[theme]

; Кольцо Урала - green
[theme.default]
css=w3-theme-kubank-grass
logo=kubank_logo_grass

; Кольцо Урала - green
[theme.Кольцо Урала]
css=w3-theme-kubank-grass
logo=kubank_logo_grass

; Кольцо Урала - brown
[theme.Кольцо Урала 2]
css=w3-theme-kubank-brown
logo=kubank_logo_brown

; Кольцо Урала - yellow
[theme.Кольцо Урала 3]
css=w3-theme-kubank-sand
logo=kubank_logo_sand

; The Beatles
[theme.The Beatles]
css=w3-theme-the-beatles
logo=The Beatles HELP

; Deep Purple
[theme.Deep Purple]
css=w3-theme-deep-purple
logo=Deep Purple

; Light
[theme.Светлая]
css=w3-theme-deep-purple
logo=Deep Purple

; Dark
[theme.Темная]
css=w3-theme-dark
logo=Deep Purple
var_dump($f3->theme)

result:

array(11) {
  ["default"]=>
  array(2) {
    ["css"]=>
    string(21) "w3-theme-kubank-grass"
    ["logo"]=>
    string(17) "kubank_logo_grass"
  }
  ["Кольцо"]=>
  NULL
  ["Кольцо Урала"]=>
  array(2) {
    ["css"]=>
    string(21) "w3-theme-kubank-grass"
    ["logo"]=>
    string(17) "kubank_logo_grass"
  }
  ["Кольцо Урала 2"]=>
  array(2) {
    ["css"]=>
    string(21) "w3-theme-kubank-brown"
    ["logo"]=>
    string(17) "kubank_logo_brown"
  }
  ["Кольцо Урала 3"]=>
  array(2) {
    ["css"]=>
    string(20) "w3-theme-kubank-sand"
    ["logo"]=>
    string(16) "kubank_logo_sand"
  }
  ["The"]=>
  NULL
  ["The Beatles"]=>
  array(2) {
    ["css"]=>
    string(20) "w3-theme-the-beatles"
    ["logo"]=>
    string(16) "The Beatles HELP"
  }
  ["Deep"]=>
  NULL
  ["Deep Purple"]=>
  array(2) {
    ["css"]=>
    string(20) "w3-theme-deep-purple"
    ["logo"]=>
    string(11) "Deep Purple"
  }
  ["Светлая"]=>
  array(2) {
    ["css"]=>
    string(20) "w3-theme-deep-purple"
    ["logo"]=>
    string(11) "Deep Purple"
  }
  ["Темная"]=>
  array(2) {
    ["css"]=>
    string(13) "w3-theme-dark"
    ["logo"]=>
    string(11) "Deep Purple"
  }
}

Here we have two false keys ["The"] and ["Deep"] with NULL values

Can I get patch for config function or have to wait for new release?

@xfra35
Copy link
Collaborator

xfra35 commented Apr 8, 2019

I think this is linked to this change but I'm not sure what was the intention behind it.

@ikkez do you remember?

@xfra35 xfra35 added the bug label Apr 8, 2019
@ikkez
Copy link
Collaborator

ikkez commented Apr 8, 2019

yeah related to f3-factory/fatfree-core#38
This should fix the issue: ((?:[^:])+)

@vinser
Copy link
Author

vinser commented Apr 8, 2019

I put it here and the issue was fixed
if (preg_match(
'/^(?!(?:global|config|route|map|redirect)s\b)'.
'((?:.?\w)+)((?:[^:])+)/i',$sec,$msec) &&
!$this->exists($msec[0]))
$this->set($msec[0],NULL);

xfra35 added a commit to f3-factory/fatfree-core that referenced this issue Apr 9, 2019
@xfra35
Copy link
Collaborator

xfra35 commented Apr 9, 2019

Should be fixed in f3-factory/fatfree-core@caec2fc

@ikkez ikkez closed this as completed May 2, 2019
ikkez added a commit to f3-factory/fatfree-core that referenced this issue Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants