summaryrefslogtreecommitdiff
path: root/ext/standard/info.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/info.c')
-rw-r--r--ext/standard/info.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/ext/standard/info.c b/ext/standard/info.c
index df8a71cc75..0f04665998 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -473,15 +473,26 @@ PHP_FUNCTION(phpinfo)
/* }}} */
-/* {{{ proto string phpversion(void)
+/* {{{ proto string phpversion([string extension])
Return the current PHP version */
PHP_FUNCTION(phpversion)
{
- if (ZEND_NUM_ARGS() != 0) {
+ zval **arg;
+ int argc = ZEND_NUM_ARGS();
+
+ if (argc == 0) {
+ RETURN_STRING(PHP_VERSION, 1);
+ } else if (argc == 1 && zend_get_parameters_ex(1, &arg) == SUCCESS) {
+ char *version;
+ convert_to_string_ex(arg);
+ version = zend_get_module_version(Z_STRVAL_PP(arg));
+ if (version == NULL) {
+ RETURN_FALSE;
+ }
+ RETURN_STRING(version, 1);
+ } else {
WRONG_PARAM_COUNT;
- }
-
- RETURN_STRING(PHP_VERSION, 1);
+ }
}
/* }}} */