Issue

ZF-11612: Zend_Config_Ini incorrectly parses arrays referenced by nested keys

Issue Type: Bug Created: 2011-07-26T21:28:25.000+0000 Last Updated: 2011-07-28T18:35:41.000+0000 Status: Resolved Fix version(s): Reporter: Gabor Nagy (gabor_nagy) Assignee: Rob Allen (rob) Tags: - Zend_Config

Related issues: - ZF-10148

Attachments: - ZF-11612.patch

Description

Using the following input INI file

<pre class="highlight">
test.id = "sample"
test.name = "Sample name"

test.model.defaultLocale = "en_US"
test.model.locales[] = "hu_HU"
test.model.locales[] = "en_US"
test.model.locales[] = "de_DE"

test.db.connectionString = "sample connection string"

and PHP code (I am calling toArray() to make the dump more readable)

<pre class="highlight">
$config = new Zend_Config_Ini('sample.ini');
var_dump($config->toArray());

The result will be

<pre class="highlight">
array
  'test' => 
    array
      'id' => string 'sample' (length=6)
      'name' => string 'Sample name' (length=11)
      'model' => 
        array
          'defaultLocale' => string 'en_US' (length=5)
      'db' => 
        array
          'connectionString' => string 'sample connection string' (length=24)
  'test.model.locales' => 
    array
      0 => string 'hu_HU' (length=5)
      1 => string 'en_US' (length=5)
      2 => string 'de_DE' (length=5)

I believe 'test.model.locales' array should be placed inside 'test' array by key name 'locales'.

Comments

Posted by Gabor Nagy (gabor_nagy) on 2011-07-26T21:40:05.000+0000

If I have not misunderstood the intended working of the component and the behaviour I have described above happens to be a bug, you may find my suggested solution in the patch attached.

It does not break existing unit tests but an extra test case should be added to cover the bug.

Posted by Gabor Nagy (gabor_nagy) on 2011-07-27T09:00:23.000+0000

Sorry, I have noticed too late that this is a duplicate.

Posted by Matthew Weier O'Phinney (matthew) on 2011-07-28T18:35:41.000+0000

Closing as won't fix per the issue this duplicates.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2020 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts