forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug that $this is not Yaf_View_Simple in render method
Fixed memleak in Yaf_View_Simple::display()
- Loading branch information
Showing
2 changed files
with
82 additions
and
27 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--TEST-- | ||
Check nesting view render | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("yaf")) print "skip"; ?> | ||
--INI-- | ||
yaf.use_spl_autoload=0 | ||
yaf.lowcase_path=0 | ||
--FILE-- | ||
<?php | ||
require "build.inc"; | ||
startup(); | ||
|
||
$config = array( | ||
"application" => array( | ||
"directory" => APPLICATION_PATH, | ||
), | ||
); | ||
|
||
file_put_contents(APPLICATION_PATH . "/Bootstrap.php", <<<PHP | ||
<?php | ||
class Bootstrap extends Yaf_Bootstrap_Abstract { | ||
public function _initReturn(Yaf_Dispatcher \$dispatcher) { | ||
\$dispatcher->returnResponse(true); | ||
} | ||
} | ||
PHP | ||
); | ||
|
||
file_put_contents(APPLICATION_PATH . "/controllers/Index.php", <<<PHP | ||
<?php | ||
class IndexController extends Yaf_Controller_Abstract { | ||
public function init() { | ||
Yaf_Dispatcher::getInstance()->flushInstantly(true); | ||
} | ||
public function indexAction() { | ||
var_dump(\$this->_view->getScriptPath()); | ||
} | ||
} | ||
PHP | ||
); | ||
|
||
file_put_contents(APPLICATION_PATH . "/views/index/index.phtml", "<?print_r(\$this); \$this->display('index/sub.phtml', array('content' => 'dummy'));?>"); | ||
file_put_contents(APPLICATION_PATH . "/views/index/sub.phtml", "<?echo \$content; echo \$this->eval('foobar'); ?>"); | ||
|
||
$app = new Yaf_Application($config); | ||
$response = $app->bootstrap()->run(); | ||
?> | ||
--CLEAN-- | ||
<?php | ||
require "build.inc"; | ||
shutdown(); | ||
?> | ||
--EXPECTF-- | ||
string(%d) "%sviews" | ||
Yaf_View_Simple Object | ||
( | ||
[_tpl_vars:protected] => Array | ||
( | ||
) | ||
|
||
[_tpl_dir:protected] => %sapplication%cviews | ||
[_options:protected] => | ||
) | ||
dummyfoobar |
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