php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #49294
Patch bug-49294 revision 2010-05-28 02:31 UTC by kalle@php.net

Patch bug-49294 for Reflection related Bug #49294

Patch version 2010-05-28 02:31 UTC

Return to Bug #49294 | Download this patch
Patch Revisions:

Developer: kalle@php.net

Index: php_reflection.c
===================================================================
--- php_reflection.c	(revision 299887)
+++ php_reflection.c	(working copy)
@@ -5182,19 +5182,37 @@
 }
 /* }}} */
 
-/* {{{ proto public void ReflectionExtension::info()
+/* {{{ proto public void ReflectionExtension::info([ $return = false ])
        Prints phpinfo block for the extension */
 ZEND_METHOD(reflection_extension, info)
 {
 	reflection_object *intern;
 	zend_module_entry *module;
+	zend_bool retval = 0;
 
-	if (zend_parse_parameters_none() == FAILURE) {
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &retval) == FAILURE) {
 		return;
 	}
 	GET_REFLECTION_OBJECT_PTR(module);
 
-	php_info_print_module(module TSRMLS_CC);
+	if (!retval) {
+		php_info_print_module(module TSRMLS_CC);
+	} else {
+		zval *ini_entries = NULL;
+
+		array_init(return_value);
+		add_assoc_string(return_value, "name", (char *) module->name, 1);
+
+		if (module->version) {
+			add_assoc_string(return_value, "version", (char *) module->version, 1);
+		}
+
+		MAKE_STD_ZVAL(ini_entries);
+		array_init(ini_entries);
+
+		zend_hash_apply_with_arguments(EG(ini_directives) TSRMLS_CC, (apply_func_args_t) _addinientry, 2, ini_entries, module->module_number);
+		add_assoc_zval(return_value, "ini", ini_entries);
+	}
 }
 /* }}} */
 
@@ -5734,6 +5752,10 @@
 	ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO(arginfo_reflection_extension_info, 0)
+	ZEND_ARG_INFO(0, retval)
+ZEND_END_ARG_INFO()
+
 static const zend_function_entry reflection_extension_functions[] = {
 	ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
 	ZEND_ME(reflection_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC)
@@ -5747,7 +5769,7 @@
 	ZEND_ME(reflection_extension, getClasses, arginfo_reflection__void, 0)
 	ZEND_ME(reflection_extension, getClassNames, arginfo_reflection__void, 0)
 	ZEND_ME(reflection_extension, getDependencies, arginfo_reflection__void, 0)
-	ZEND_ME(reflection_extension, info, arginfo_reflection__void, 0)
+	ZEND_ME(reflection_extension, info, arginfo_reflection_extension_info, 0)
 	ZEND_ME(reflection_extension, isPersistent, arginfo_reflection__void, 0)
 	ZEND_ME(reflection_extension, isTemporary, arginfo_reflection__void, 0)
 	{NULL, NULL, NULL}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC