Created
February 4, 2013 18:24
-
-
Save tomasfejfar/4708522 to your computer and use it in GitHub Desktop.
Nasty bug/fail in Zend_View_Abstract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Clear all assigned variables | |
* | |
* Clears all variables assigned to Zend_View either via {@link assign()} or | |
* property overloading ({@link __set()}). | |
* | |
* @return void | |
*/ | |
public function clearVars() | |
{ | |
$vars = get_object_vars($this); | |
foreach ($vars as $key => $value) { | |
if ('_' != substr($key, 0, 1)) { | |
unset($this->$key); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was a necessary hack in ZF1. Since the coding standards used underscores to indicate non-public visibility, the way to play nice when extending it is to keep non-public members underscore-prefixed.
There's really no clean way to fix this, as the variables are members of the view object itself. We fixed it in ZF2... but only by making architectural changes.