From f7d22b60f03ba0306e105feffb803ded42d00cda Mon Sep 17 00:00:00 2001 From: foobar Date: Sat, 9 Jun 2007 11:44:08 +0000 Subject: [PATCH] MFH:- Added php_ini_loaded_file() function which returns the path to the actual php.ini in use. --- NEWS | 2 ++ ext/standard/basic_functions.c | 5 +++++ ext/standard/info.c | 12 ++++++++++++ ext/standard/info.h | 1 + 4 files changed, 20 insertions(+) diff --git a/NEWS b/NEWS index 7f299024ff..1fbaf6ce8e 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2007, PHP 5.2.4 - Improved fix for MOPB-03-2007. (Ilia) - Corrected fix for CVE-2007-2872. (Ilia) +- Added php_ini_loaded_file() function which returns the path to the actual + php.ini in use. (Jani) - Added GD version constants GD_MAJOR_VERSION, GD_MINOR_VERSION GD_RELEASE_VERSION, GD_EXTRA_VERSION and GD_VERSION_STRING. (Pierre) - Added missing open_basedir checks to CGI. (anight at eyelinkmedia dot com, diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index fe060e29de..d81c0868a3 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1765,6 +1765,10 @@ ZEND_END_ARG_INFO() static ZEND_BEGIN_ARG_INFO(arginfo_php_ini_scanned_files, 0) ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO(arginfo_php_ini_loaded_file, 0) +ZEND_END_ARG_INFO() /* }}} */ /* {{{ iptc.c */ static @@ -3132,6 +3136,7 @@ zend_function_entry basic_functions[] = { PHP_FE(php_sapi_name, arginfo_php_sapi_name) PHP_FE(php_uname, arginfo_php_uname) PHP_FE(php_ini_scanned_files, arginfo_php_ini_scanned_files) + PHP_FE(php_ini_loaded_file, arginfo_php_ini_loaded_file) PHP_FE(strnatcmp, arginfo_strnatcmp) PHP_FE(strnatcasecmp, arginfo_strnatcasecmp) diff --git a/ext/standard/info.c b/ext/standard/info.c index eb587366a0..878e832c67 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -1170,6 +1170,18 @@ PHP_FUNCTION(php_ini_scanned_files) } /* }}} */ +/* {{{ proto string php_ini_loaded_file(void) + Return the actual loaded ini filename */ +PHP_FUNCTION(php_ini_loaded_file) +{ + if (php_ini_opened_path) { + RETURN_STRING(php_ini_opened_path, 1); + } else { + RETURN_FALSE; + } +} +/* }}} */ + /* * Local variables: * tab-width: 4 diff --git a/ext/standard/info.h b/ext/standard/info.h index 71ab2a51cb..a54d0e2460 100644 --- a/ext/standard/info.h +++ b/ext/standard/info.h @@ -66,6 +66,7 @@ PHP_FUNCTION(php_egg_logo_guid); PHP_FUNCTION(php_sapi_name); PHP_FUNCTION(php_uname); PHP_FUNCTION(php_ini_scanned_files); +PHP_FUNCTION(php_ini_loaded_file); PHPAPI char *php_info_html_esc(char *string TSRMLS_DC); PHPAPI void php_info_html_esc_write(char *string, int str_len TSRMLS_DC); PHPAPI void php_print_info_htmlhead(TSRMLS_D); -- 2.40.0