Cakephp: Impossible to escape `.` in Configure::read() and Configure::write()

Created on 3 May 2017  路  2Comments  路  Source: cakephp/cakephp

This is a (multiple allowed):

  • [x] bug
  • [x] enhancement
  • [x] feature-discussion (RFC)

  • CakePHP Version: 2.9.7.

  • Platform and Target: Linux, MySQL, Apache.

What you did

What happened

Configure::read('Session.ini') returns an arrray

array(
    ...
    'session.use_cookies' => (int) 1,
    ...
)

but
Configure::read('Session.ini.session.use_cookies') returns null,
Configure::read('Session.ini.session\.use_cookies') returns null too.

The same situation with write() - Configure::write('Session.ini.session.use_cookies', 0); does not change the existing value but creates a new 'session' array.

What you expected to happen

I would expect Configure::read('Session.ini.session\.use_cookies') to return an existing value and Configure::write('Session.ini.session\.use_cookies', 0) to overwrite the existing value.

need-more-info

Most helpful comment

Hash::get() doesn't support keys with . in them, and I'm not sure it should. Adding complexity to handle rare scenarios like this.

All 2 comments

Hash::get() doesn't support keys with . in them, and I'm not sure it should. Adding complexity to handle rare scenarios like this.

It's doesn't take much effort to fetch $iniVals = Configure::read('Session.ini') modify the array and write it again Configure::write('Session.ini', $iniVals). So I agree with @markstory it's not worth adding extra complexity to Hash::get() for such edge cases.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josbeir picture josbeir  路  3Comments

thinkingmedia picture thinkingmedia  路  3Comments

Erwane picture Erwane  路  3Comments

ndm2 picture ndm2  路  3Comments

GBeushausen picture GBeushausen  路  3Comments