Issue Type: Bug Created: 2010-07-13T03:31:46.000+0000 Last Updated: 2012-05-27T21:34:24.000+0000 Status: Resolved Fix version(s): - 1.11.11 (29/Sep/11)
Reporter: Micha Verboeket (mverboeket) Assignee: Pádraic Brady (padraic) Tags: - Zend_Navigation
Related issues: - ZF-8402
Attachments: - Page.php.patch
When using a navigation xml config file the visible-option is not working as expected as it is not accepting booleans (true/false) as values. This is accepted:
<pre class="highlight">
This is ignored:
<pre class="highlight">
false
"false" value is accepted in array configs to this is a little bit confusing and I do not see a reason for forcing integer values as it is actually a flag.
A possible quick fix would be in Zend/Navigation/Page.php on line 731:
<pre class="highlight">
and changing it to:
but I am not sure if this is the right place to fix this. The problem here is that the string "false" is casted to boolean true.
Posted by Kai Uwe (kaiuwe) on 2011-02-16T03:37:48.000+0000
Hello Micha, {quote} and changing it to:
<pre class="highlight">
{quote}
Bad idea:
true
<pre class="highlight">
becomes
false
<pre class="highlight">
My proposal for this problem:
public function setVisible($visible = true) { if ('false' === strtolower($visible)) { $visible = false; }
$this->_visible = (bool) $visible;
return $this;
} ``` ??but I am not sure if this is the right place to fix this.?? The documentation says: {quote} Note: Return Type Configuration data read into Zend_Config_Xml are always returned as strings. Conversion of data from strings to other types is left to developers to suit their particular needs. {quote} [http://framework.zend.com/manual/en/…]
Posted by Frank Brückner (frosch) on 2011-08-13T14:43:21.000+0000
Fix and unit test added.
Posted by Pádraic Brady (padraic) on 2011-09-04T12:37:10.000+0000
Fixed in r24442 and ZF2 via PR. Thanks for the patch!!!