]> granicus.if.org Git - php/commitdiff
- New ReflectionExtension::info() function to print the phpinfo() block
authorJohannes Schlüter <johannes@php.net>
Tue, 24 Jul 2007 23:15:58 +0000 (23:15 +0000)
committerJohannes Schlüter <johannes@php.net>
Tue, 24 Jul 2007 23:15:58 +0000 (23:15 +0000)
  for an extension. [DOC]

NEWS
ext/reflection/php_reflection.c
ext/reflection/tests/026.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index e1795f0ea2580e5dbfbddc1ae3958d50ed968354..8056a54b0499c4f6f169cd45470017f18dd3592d 100644 (file)
--- 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)
index e4f7407b1dc055a19183a6ce19c269a474259059..916a0a31886fd462e0f29d40000251af0cef521a 100644 (file)
@@ -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 (file)
index 0000000..e4c6a3f
--- /dev/null
@@ -0,0 +1,36 @@
+--TEST--
+reflectionExtension::info()
+--SKIPIF--
+<?php extension_loaded('reflection') or die('skip'); ?>
+--FILE--
+<?php
+$r = new ReflectionExtension("reflection");
+$r->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!