Skip to content

Commit

Permalink
Fixed Bug #70913 (Segfault while new Yaf_Controller)
Browse files Browse the repository at this point in the history
laruence committed Nov 14, 2015
1 parent 14086e7 commit 632c0ad
Showing 2 changed files with 52 additions and 1 deletion.
51 changes: 51 additions & 0 deletions tests/bug70913.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
--TEST--
Bug #70913 (Segfault while new Yaf_Controller)
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
--INI--
yaf.use_spl_autoload=1
yaf.lowcase_path=0
yaf.throw_exception=0
yaf.catch_exception=1
yaf.use_namespace=0
--FILE--
<?php
require "build.inc";
startup();

$config = array(
"application" => array(
"directory" => APPLICATION_PATH,
),
);

file_put_contents(APPLICATION_PATH . "/controllers/Index.php", <<<PHP
<?php
class IndexController extends Yaf_Controller_Abstract {
public function indexAction() {
new SecondController(\$this->getRequest(), \$this->getResponse(), \$this->getView());
}
}
PHP
);

file_put_contents(APPLICATION_PATH . "/controllers/Second.php", <<<PHP
<?php
class SecondController extends Yaf_Controller_Abstract {
}
PHP
);

file_put_contents(APPLICATION_PATH . "/views/index/index.phtml", "Okey");

$app = new Yaf_Application($config);
$response = $app->run();
echo "Okey";
?>
--CLEAN--
<?php
require "build.inc";
shutdown();
?>
--EXPECTF--
Fatal error: Call to private Yaf_Controller_Abstract::__construct() from context 'IndexController' in %sIndex.php on line %d
2 changes: 1 addition & 1 deletion yaf_controller.c
Original file line number Diff line number Diff line change
@@ -549,7 +549,7 @@ zend_function_entry yaf_controller_methods[] = {
PHP_ME(yaf_controller, redirect, yaf_controller_redirect_arginfo,ZEND_ACC_PUBLIC)
PHP_ME(yaf_controller, getInvokeArgs,yaf_controller_void_arginfo, ZEND_ACC_PUBLIC)
PHP_ME(yaf_controller, getInvokeArg, yaf_controller_getiarg_arginfo,ZEND_ACC_PUBLIC)
PHP_ME(yaf_controller, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_FINAL|ZEND_ACC_PUBLIC)
PHP_ME(yaf_controller, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_FINAL|ZEND_ACC_PRIVATE)
PHP_ME(yaf_controller, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
{NULL, NULL, NULL}
};

0 comments on commit 632c0ad

Please sign in to comment.