Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

Zend_Config_Yaml inline hash values being incorrectly treated as comments #686

Open
jaffacake opened this issue Apr 13, 2016 · 0 comments
Open

Comments

@jaffacake
Copy link

jaffacake commented Apr 13, 2016

This issue was raised here previously: http://framework.zend.com/issues/browse/ZF-12278

We have currently had to implement a workaround by storing the # as * instead and then converting this back to a hash after parsing.

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 either.

Potential solution proposed from initial issue:

@ 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants