Issues

ZF-12278: Zend_Config_Yaml comment hash bug

Issue Type: Bug Created: 2012-06-12T00:44:55.000+0000 Last Updated: 2013-01-18T13:34:57.000+0000 Status: Open Fix version(s): Reporter: Hayden King (hking) Assignee: None Tags: - Zend_Config

Related issues: Attachments:

Description

http://framework.zend.com/issues/browse/ZF-11329

The fix in the above ticket allows for in-line comments at the end of the value but causes a bug that prevents values with legitimate hash characters such as passwords from being read properly. Encasing the value within double or single quotes did not resolve the problem wither.

I did alter a couple of regex strings in "Zend/Config/Yaml.php" that appears to have resolved it.

<pre class="literal">
@ Line 289:
            // New
            $line = rtrim(preg_replace("/^#.*$/", "", $line));

            // Old
            $line = rtrim(preg_replace("/#.*$/", "", $line));

@ Line 317: 
            // New simple key: value
            $value = rtrim( preg_replace( "/(.*)(\s+#.*?)$/", "\\1", $m[2] ) );

            // Old simple key: value
            $value = rtrim(preg_replace("/#.*$/", "", $m[2]));

This update appears to allow a hash at the beginning of the line to comment the entire line, a hash at the end of the value for an in-line comment and to allow for a hash to remain in the value when using hashes in passwords or anything else someone may want/need.

Comments

No comments to display

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

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

Contacts