#5750: Configure::write() Only Supports Keys 3 Levels Deep
---------------------------------------------+------------------------------
    Reporter:  pr1001                        |          Type:  Bug   
      Status:  new                           |      Priority:  Low   
   Milestone:  1.2.x.x                       |     Component:  Config
     Version:  RC3                           |      Severity:  Minor 
    Keywords:  configure, write, key, depth  |   Php_version:  PHP 5 
Cake_version:                                |  
---------------------------------------------+------------------------------
 == Problem ==
 This code works:
 {{{
 Configure::write('Depth1.Depth2.Depth3', 'XXXXXX');
 Configure::read('Depth1.Depth2.Depth3');
 }}}
 While this does not:
 {{{
 Configure::write('Depth1.Depth2.Depth3.Depth4', 'YYYYYY');
 Configure::read('Depth1.Depth2.Depth3.Depth4');
 }}}

 == Cause ==
 In lines [http://api.cakephp.org/configure_8php-source.html#l00257 257] to
 [http://api.cakephp.org/configure_8php-source.html#l00268 268] of
 [http://api.cakephp.org/configure_8php-source.html configure.php] there
 are only cases for 2 and for 3 levels of depth, with anything else
 considered as 1 level of depth:

 {{{
 switch (count($name)) {
     case 3:
         $_this->{$name[0]}[$name[1]][$name[2]] = $value;
     break;
     case 2:
         $_this->{$name[0]}[$name[1]] = $value;
     break;
     default:
         $_this->{$name[0]} = $value;
     break;
 }
 }}}


 == Solution? ==
 I'm not sure this is even a bug, so perhaps the only change needed is to
 add a note about this to the documentation.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5750>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to