Issues

ZF-11934: Zend_Config_Yaml should strip quotes in values

Issue Type: Bug Created: 2011-12-12T14:36:28.000+0000 Last Updated: 2012-04-16T20:15:58.000+0000 Status: Resolved Fix version(s): - 1.12.0 (27/Aug/12)

Reporter: Maksym Sliesarenko (sm) Assignee: Ryan Mauger (bittarman) Tags: - Zend_Config

  • state:patch-ready-for-review
  • zf-crteam-review

Related issues: Attachments: - ZF-11934.patch

Description

<pre class="highlight"> 
one: 'two'

will result

<pre class="highlight">
array('one' => "'two'")

Comments

Posted by Maksym Sliesarenko (sm) on 2011-12-12T14:46:15.000+0000

Added patch with fix and tests

Posted by Adam Lundrigan (adamlundrigan) on 2012-02-24T18:05:45.000+0000

Your patch appears to include the tests for your fix to ZF-11363.

Confirmed. Test:

<pre class="highlight">

Index: tests/Zend/Config/YamlTest.php
===================================================================
--- tests/Zend/Config/YamlTest.php      (revision 24628)
+++ tests/Zend/Config/YamlTest.php      (working copy)
@@ -50,6 +50,7 @@
         $this->_yamlIndentedCommentsConfig  = dirname(__FILE__) . '/_files/indentedcomments.yaml';
         $this->_yamlListConstantsConfig     = dirname(__FILE__) . '/_files/listconstants.yaml';
         $this->_listBooleansConfig          = dirname(__FILE__) . '/_files/listbooleans.yaml';
+        $this->_yamlSingleQuotedString    = dirname(__FILE__) . '/_files/zf11934.yaml';
     }

     public function testLoadSingleSection()
@@ -406,4 +407,13 @@
         $this->assertFalse($config->usingCapitalOff->{0});
     }

+    /**
+     * @group ZF-11934
+     */
+    public function testAllowsSingleQuotedStringValues()
+    {
+        $config = new Zend_Config_Yaml($this->_yamlSingleQuotedString);
+        $this->assertEquals('two', $config->one);
+    }
+
 }

Result:

<pre class="highlight">

1) Zend_Config_YamlTest::testAllowsSingleQuotedStringValues
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-two
+'two'

After applying the fix supplied in your patch, this unit test (and all others in Zend_Config_Yaml) pass.

Posted by Adam Lundrigan (adamlundrigan) on 2012-02-24T18:12:21.000+0000

Attached my version of OP's patch: ZF-11934_adamlundrigan.patch

Posted by Ryan Mauger (bittarman) on 2012-04-16T20:15:58.000+0000

Applied modified patch from Adam Lundrigan in r24712.

Set to next Minor release rather than mini to note the fact that this is a BC break (even though very small)

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