[Beeframework-svn] SF.net SVN: beeframework:[106] trunk/framework/Bee/Context
Brought to you by:
b_hartmann,
m_plomer
From: <m_p...@us...> - 2013-11-03 13:36:02
|
Revision: 106 http://sourceforge.net/p/beeframework/code/106 Author: m_plomer Date: 2013-11-03 13:36:00 +0000 (Sun, 03 Nov 2013) Log Message: ----------- - use filter_var(VALIDATE_BOOLEAN) for boolean attributes in ParserDelegate - fixed array merging to consider both the type of the current array and that of the parent Modified Paths: -------------- trunk/framework/Bee/Context/Config/ArrayValue.php trunk/framework/Bee/Context/Xml/ParserDelegate.php Modified: trunk/framework/Bee/Context/Config/ArrayValue.php =================================================================== --- trunk/framework/Bee/Context/Config/ArrayValue.php 2013-10-31 11:38:34 UTC (rev 105) +++ trunk/framework/Bee/Context/Config/ArrayValue.php 2013-11-03 13:36:00 UTC (rev 106) @@ -82,8 +82,9 @@ function merge(Traversable $parent) { $tmpArray = array(); + $parentAssoc = $parent instanceof Bee_Context_Config_ArrayValue && $parent->associative; foreach ($parent as $key => $value) { - if($this->associative) { + if($parentAssoc) { $tmpArray[$key] = $value; } else { array_push($tmpArray, $value); Modified: trunk/framework/Bee/Context/Xml/ParserDelegate.php =================================================================== --- trunk/framework/Bee/Context/Xml/ParserDelegate.php 2013-10-31 11:38:34 UTC (rev 105) +++ trunk/framework/Bee/Context/Xml/ParserDelegate.php 2013-11-03 13:36:00 UTC (rev 106) @@ -31,8 +31,6 @@ */ const BEANS_NAMESPACE_URI = 'http://www.beeframework.org/schema/beans'; - const TRUE_VALUE = 'true'; - const DEFAULT_VALUE = 'default'; const BEAN_ELEMENT = 'bean'; @@ -129,7 +127,7 @@ public function initDefaults(DOMElement $root) { $defaults = new Bee_Context_Xml_DocumentDefaultsDefinition(); - $defaults->setMerge($root->getAttribute(self::DEFAULT_MERGE_ATTRIBUTE) === self::TRUE_VALUE); + $defaults->setMerge(filter_var($root->getAttribute(self::DEFAULT_MERGE_ATTRIBUTE), FILTER_VALIDATE_BOOLEAN)); if($root->hasAttribute(self::DEFAULT_INIT_METHOD_ATTRIBUTE)) { $defaults->setInitMethod($root->getAttribute(self::DEFAULT_INIT_METHOD_ATTRIBUTE)); } @@ -234,7 +232,7 @@ Bee_Context_Xml_Utils::parseScopeAttribute($ele, $bd, $containingBd); if ($ele->hasAttribute(self::ABSTRACT_ATTRIBUTE)) { - $bd->setAbstract(self::TRUE_VALUE === $ele->getAttribute(self::ABSTRACT_ATTRIBUTE)); + $bd->setAbstract(filter_var($ele->getAttribute(self::ABSTRACT_ATTRIBUTE), FILTER_VALIDATE_BOOLEAN)); } Bee_context_Xml_Utils::parseDependsOnAttribute($ele, $bd); @@ -654,7 +652,7 @@ if($collectionElement->hasAttribute(self::MERGE_ATTRIBUTE)) { $value = $collectionElement->getAttribute(self::MERGE_ATTRIBUTE); if (self::DEFAULT_VALUE !== $value) { - return self::TRUE_VALUE === $value; + return filter_var($value, FILTER_VALIDATE_BOOLEAN); } } return $this->defaults->getMerge(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |