Zend Framework

Zend_Config_Xml usage without sections bug

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.2
  • Fix Version/s: 1.0.3
  • Component/s: Zend_Config
  • Labels:
    None
  • Fix Version Priority:
    Must Have

Description

It appears the Zend_Config_Xml class does not differ from a SimpleXMLElement that contains children vs on that does not (eg a string) when not using sections.

For instance:

$config = new Zend_Config_Xml('ourFile.xml', null);

This would load everything under the root element without the use of sections, but because of this bug, it will set any 1st level element within the root element that is a string to an empty Zend_Config object instead of a string which is expected.

<root>
    <!-- Should be a string -->
    <home>../application</home>

    <!-- Should be another Zend_Config Object -->
    <other>
        <foo>bar</foo>
    </other>
</root>

The following would be accessed like this:

echo $config->home; // Errors out because it contains an empty Zend_Config obj;

Attached is the patch

  1. application.xml
    16/Nov/07 5:42 PM
    1 kB
    Geoffrey Tran
  2. Zend_Config_Xml.diff
    06/Nov/07 10:40 PM
    0.8 kB
    Geoffrey Tran

Activity

Hide
Darby Felton added a comment -

Assigning to Rob Allen to initiate issue review.

Show
Darby Felton added a comment - Assigning to Rob Allen to initiate issue review.
Hide
Rob Allen added a comment -

Hi Geoffrey,

Can you provide an example config.xml please ?

Thanks,

Rob...

Show
Rob Allen added a comment - Hi Geoffrey, Can you provide an example config.xml please ? Thanks, Rob...
Hide
Geoffrey Tran added a comment -

ok attaching the file...

The bug would happen on access to home and throw_exceptions since they are 1st level elements

Show
Geoffrey Tran added a comment - ok attaching the file... The bug would happen on access to home and throw_exceptions since they are 1st level elements
Hide
Rob Allen added a comment -

Resolved in svn 6906 and svn 6907

Show
Rob Allen added a comment - Resolved in svn 6906 and svn 6907

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: