Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.11.6
-
Component/s: Zend_Config
-
Labels:None
-
Tags:
Description
It seems the only comments getting properly ignored are those that begin a line. Comments after a value incorrectly remain as part of the value
Example:
Good -
resources:
frontController:
controllerDirectory: APPLICATION_PATH/controllers
Bad -
resources:
frontController:
controllerDirectory: APPLICATION_PATH/controllers #heynow!
Attachments
Issue Links
| This issue is duplicated by: | ||||
| ZF-11384 | Zend_Config_Yaml comment should allow indented comments |
|
|
|
Attached a testsuite patch which reproduces the issue based upon the OP's description of the problem.
Run Result:
Attached a fix patch which includes the reproduction testsuite and the suggested fix:
--- library/Zend/Config/Yaml.php (revision 23879) +++ library/Zend/Config/Yaml.php (working copy) @@ -315,7 +315,7 @@ // key: value if (strlen($m[2])) { // simple key: value - $value = $m[2]; + $value = rtrim(preg_replace("/#.*$/", "", $m[2])); // Check for booleans and constants if (preg_match('/^(t(rue)?|on|y(es)?)$/i', $value)) { $value = true;Full framework test suite passes after change is performed
--- library/Zend/Config/Yaml.php (revision 23879) +++ library/Zend/Config/Yaml.php (working copy) @@ -315,7 +315,7 @@ // key: value if (strlen($m[2])) { // simple key: value - $value = $m[2]; + $value = rtrim(preg_replace("/#.*$/", "", $m[2])); // Check for booleans and constants if (preg_match('/^(t(rue)?|on|y(es)?)$/i', $value)) { $value = true;