Created
October 11, 2013 05:52
-
-
Save mikespook/6930156 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
--TEST-- | |
Check for Yaf_Controller::finalize | |
--SKIPIF-- | |
<?php if (!extension_loaded("yaf")) print "skip"; ?> | |
--FILE-- | |
<?php | |
$config = array( | |
"application" => array( | |
"directory" => realpath(dirname(__FILE__)), | |
"dispatcher" => array( | |
"catchException" => 0, | |
"throwException" => 1, | |
), | |
"modules" => "module", | |
), | |
); | |
class ControllerController extends Yaf_Controller_Abstract { | |
public function init() { | |
echo "init\n"; | |
} | |
public function finalize() { | |
echo "final\n"; | |
} | |
public function indexAction() { | |
echo "okey\n"; | |
return FALSE; | |
} | |
} | |
$app = new Yaf_Application($config); | |
$request = new Yaf_Request_Http("/module/controller/index"); | |
$app->getDispatcher()->returnResponse(false)->dispatch($request); | |
?> | |
--EXPECTF-- | |
init | |
okey | |
final |
This file contains hidden or 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
--- yaf_controller.c 2013-01-04 18:51:51.000000000 +0800 | |
+++ yaf_controller.c 2013-10-11 13:44:34.483855468 +0800 | |
@@ -264,6 +264,25 @@ | |
} | |
/* }}} */ | |
+/** {{{ proto public Yaf_Controller_Abstract::finalize() | |
+*/ | |
+PHP_METHOD(yaf_controller, finalize) { | |
+} | |
+ | |
+/* }}} */ | |
+ | |
+/** {{{ proto protected Yaf_Controller_Abstract::__destruct() | |
+*/ | |
+PHP_METHOD(yaf_controller, __destruct) { | |
+ yaf_controller_t *self = getThis(); | |
+ zend_class_entry *ce = zend_get_class_entry(self); | |
+ if (!instanceof_function(ce, yaf_action_ce TSRMLS_CC) | |
+ && zend_hash_exists(&(ce->function_table), ZEND_STRS("finalize"))) { | |
+ zend_call_method_with_0_params(&self, ce, NULL, "finalize", NULL); | |
+ } | |
+} | |
+/* }}} */ | |
+ | |
/** {{{ proto public Yaf_Controller_Abstract::getView(void) | |
*/ | |
PHP_METHOD(yaf_controller, getView) { | |
@@ -547,6 +566,7 @@ | |
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, __destruct, NULL, ZEND_ACC_FINAL|ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) | |
PHP_ME(yaf_controller, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) | |
{NULL, NULL, NULL} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment