Sfoglia il codice sorgente

merge revision 25168 to release-1.12

git-svn-id: http://framework.zend.com/svn/framework/standard/branches/release-1.12@25169 44c647ce-9c0f-0410-b52a-842ac1e357ba
rob 13 anni fa
parent
commit
90f2c5317f

+ 2 - 0
library/Zend/Config/Yaml.php

@@ -375,6 +375,8 @@ class Zend_Config_Yaml extends Zend_Config
             $value = true;
         } elseif (preg_match('/^(f(alse)?|off|n(o)?)$/i', $value)) {
             $value = false;
+        } elseif (strcasecmp($value, 'null') === 0) {
+            $value = null;
         } elseif (!self::$_ignoreConstants) {
             // test for constants
             $value = self::_replaceConstants($value);

+ 11 - 0
tests/Zend/Config/YamlTest.php

@@ -293,6 +293,17 @@ class Zend_Config_YamlTest extends PHPUnit_Framework_TestCase
         $this->assertFalse($config->usingCapitalOff);
     }
 
+    /**
+     * @group ZF-12277
+     */
+    public function testParsesTypesAccordingToOneDotTwoSpecification()
+    {
+        $config = new Zend_Config_Yaml($this->_booleansConfig, 'production');
+        $this->assertNull($config->usingLowerCasedNull);
+        $this->assertNull($config->usingTitleCasedNull);
+        $this->assertNull($config->usingCapitalNull);
+    }
+
     public function testHonorsPhpConstants()
     {
         if (!defined('ZEND_CONFIG_YAML_ENV')) {

+ 3 - 0
tests/Zend/Config/_files/booleans.yaml

@@ -27,3 +27,6 @@ production:
     usingTitleCasedOff: Off
     usingCapitalOff: OFF
 
+    usingLowerCasedNull: null
+    usingTitleCasedNull: Null
+    usingCapitalNull: NULL