ZF-10146: Zend_Navigation_Page xml option "visible" only works with integers not booleans


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:


This is ignored:


"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:

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.


Hello Micha, {quote} and changing it to:

Bad idea:




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} […]

Fix and unit test added.

Fixed in r24442 and ZF2 via PR. Thanks for the patch!!!