From 179c67a64bb9e5999504061ff66cdb5ce66d1b1d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Schl=C3=BCter?= Date: Tue, 24 Jul 2007 23:15:58 +0000 Subject: [PATCH] - New ReflectionExtension::info() function to print the phpinfo() block for an extension. [DOC] --- NEWS | 2 ++ ext/reflection/php_reflection.c | 15 ++++++++++++++ ext/reflection/tests/026.phpt | 36 +++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 ext/reflection/tests/026.phpt diff --git a/NEWS b/NEWS index e1795f0ea2..8056a54b04 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,8 @@ PHP NEWS (Andrey A. Belashkov, Tony) - Added missing MSG_EOR and MSG_EOF constants to sockets extension. (Jani) - Added PCRE_VERSION constant. (Tony) +- Added ReflectionExtension::info() function to print the phpinfo() block for + an extension. (Johannes) - Implemented FR #41884 (ReflectionClass::getDefaultProperties() does not handle static attributes). (Tony) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e4f7407b1d..916a0a3188 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4394,6 +4394,20 @@ ZEND_METHOD(reflection_extension, getDependencies) } /* }}} */ +/* {{{ proto public void ReflectionExtension::info() U + Prints phpinfo block for the extension */ +ZEND_METHOD(reflection_extension, info) +{ + reflection_object *intern; + zend_module_entry *module; + + METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0); + GET_REFLECTION_OBJECT_PTR(module); + + php_info_print_module(module TSRMLS_CC); +} +/* }}} */ + /* {{{ method tables */ static zend_function_entry reflection_exception_functions[] = { {NULL, NULL, NULL} @@ -4770,6 +4784,7 @@ static zend_function_entry reflection_extension_functions[] = { ZEND_ME(reflection_extension, getClasses, NULL, 0) ZEND_ME(reflection_extension, getClassNames, NULL, 0) ZEND_ME(reflection_extension, getDependencies, NULL, 0) + ZEND_ME(reflection_extension, info, NULL, 0) {NULL, NULL, NULL} }; /* }}} */ diff --git a/ext/reflection/tests/026.phpt b/ext/reflection/tests/026.phpt new file mode 100644 index 0000000000..e4c6a3f864 --- /dev/null +++ b/ext/reflection/tests/026.phpt @@ -0,0 +1,36 @@ +--TEST-- +reflectionExtension::info() +--SKIPIF-- + +--FILE-- +info(); + +date_default_timezone_set('Europe/Berlin'); +$r = new ReflectionExtension("date"); +$r->info(); + +echo "\nDone!\n"; + +--EXPECTF-- +Reflection + +Reflection => enabled +Version => %s + +date + +date/time support => enabled +"Olson" Timezone Database Version => %s +Timezone Database => %s +Default timezone => %s + +Directive => %s => %s +date.timezone => %s => %s +date.default_latitude => %s => %s +date.default_longitude => %s => %s +date.sunset_zenith => %s => %s +date.sunrise_zenith => %s => %s + +Done! -- 2.40.0