Zend Framework

Problem with Zend_Config_Xml and DB Params

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.9.0
  • Fix Version/s: None
  • Component/s: Zend_Config
  • Labels:
    None

Description

Hello there!

I updated to 1.9.0 and wanted to use a xml file as config from now on thanks to support of PHP constants BUT

[code]
Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /is/htdocs/wp1133477_NBOOWRX8MH/www/alpha/application/configs/app.config.xml:65: parser error : StartTag: invalid element name simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: <1002>SET NAMES utf8</1002> simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: ^ simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: /is/htdocs/wp1133477_NBOOWRX8MH/www/alpha/application/configs/app.config.xml:65: parser error : expected '>' simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: <1002>SET NAMES utf8</1002> simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-fi in /is/htdocs/wp1133477_NBOOWRX8MH/libraries/Zend_1.9.0/Zend/Config/Xml.php on line 98
[/code]

I got the error because of this line in my config file

[code]
<db>
<isDefaultTableAdapter>1</isDefaultTableAdapter>
<adapter>pdo_mysql</adapter>
<params>
<host>localhost</host>
<username>blabla</username>
<password>blublub</password>
<driver_options>
<1002>SET NAMES utf8</1002> <--- SADLY THAT DON'T WORK
</driver_options>
<dbname>brablbrabl</dbname>
</params>
</db>
[/code]

Activity

Hide
Matthew Weier O'Phinney added a comment -

Element names need to be valid PHP variable names, IIRC – which is problematic here as the various PDO_MYSQL constants are all integers, and the constants are all class static constants.

Rob or Ben – any ideas on how to improve it?

Show
Matthew Weier O'Phinney added a comment - Element names need to be valid PHP variable names, IIRC – which is problematic here as the various PDO_MYSQL constants are all integers, and the constants are all class static constants. Rob or Ben – any ideas on how to improve it?
Hide
Ben Scholzen added a comment -

A solution would be to either support class constants, and/or introduce a namespace related type like from my short params proposal for 1.6:

<zf:param zf:name="1002" zf:value="SET NAMES utf8"/>

But well, regarding this issue, SET NAMES utf8 is not required anymore, there is a <charset/> option for all DB adapters since 1.8.

Show
Ben Scholzen added a comment - A solution would be to either support class constants, and/or introduce a namespace related type like from my short params proposal for 1.6:
<zf:param zf:name="1002" zf:value="SET NAMES utf8"/>
But well, regarding this issue, SET NAMES utf8 is not required anymore, there is a <charset/> option for all DB adapters since 1.8.
Hide
Markus added a comment -

I would like to see this approach Ben. It also would be consistent with the Solution for constants.

Thank's for the hint to DB charset option. Haven't known this... hm can't find this improvement in 1.8 release notes?

Show
Markus added a comment - I would like to see this approach Ben. It also would be consistent with the Solution for constants. Thank's for the hint to DB charset option. Haven't known this... hm can't find this improvement in 1.8 release notes?
Hide
Adam Lundrigan added a comment -

Closing as "Wont't fix" due to complexity of necessary changes and existence of viable workaround (charset option)

Show
Adam Lundrigan added a comment - Closing as "Wont't fix" due to complexity of necessary changes and existence of viable workaround (charset option)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: