Issue Details (XML | Word | Printable)

Key: ZF-2162
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Rob Allen
Reporter: Geoffrey Tran
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_Config_Xml usage without sections bug

Created: 06/Nov/07 10:39 PM   Updated: 15/Dec/07 09:46 PM   Resolved: 23/Nov/07 04:32 PM
Return to search "Fixed in 1.5.1"
Component/s: Zend_Config
Affects Version/s: 1.0.2
Fix Version/s: 1.0.3

Time Tracking:
Not Specified

File Attachments: 1. XML File application.xml (1 kB)
2. File Zend_Config_Xml.diff (0.8 kB)


Fix Version Priority: Must Have


 Description  « Hide

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



Darby Felton added a comment - 09/Nov/07 02:01 PM

Assigning to Rob Allen to initiate issue review.


Rob Allen added a comment - 15/Nov/07 10:30 AM

Hi Geoffrey,

Can you provide an example config.xml please ?

Thanks,

Rob...


Geoffrey Tran added a comment - 16/Nov/07 05:42 PM

ok attaching the file...

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


Rob Allen added a comment - 23/Nov/07 04:32 PM

Resolved in svn 6906 and svn 6907