From a7c6c411e2a9f973529fc956d3ef81d3be4a1e87 Mon Sep 17 00:00:00 2001 From: Joel Marcey Date: Thu, 25 Jul 2013 09:30:25 -0700 Subject: [PATCH] Support zend_version() PEAR uses zend_version(). Let's support it too. --- hphp/runtime/ext/ext_options.cpp | 7 +++++-- hphp/test/slow/ext_options/ext_options.php | 2 ++ hphp/test/slow/ext_options/ext_options.php.expect | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hphp/runtime/ext/ext_options.cpp b/hphp/runtime/ext/ext_options.cpp index 90aec44bc..4b323d48e 100644 --- a/hphp/runtime/ext/ext_options.cpp +++ b/hphp/runtime/ext/ext_options.cpp @@ -36,6 +36,8 @@ #include "hphp/runtime/vm/request_arena.h" +#define ZEND_VERSION "2.4.99" + namespace HPHP { /////////////////////////////////////////////////////////////////////////////// @@ -858,7 +860,7 @@ String f_sys_get_temp_dir() { } String f_zend_logo_guid() { - throw NotSupportedException(__func__, "not zend anymore"); + throw NotSupportedException(__func__, "deprecated and removed"); } int64_t f_zend_thread_id() { @@ -866,9 +868,10 @@ int64_t f_zend_thread_id() { } String f_zend_version() { - throw NotSupportedException(__func__, "not zend anymore"); + return ZEND_VERSION; } + /////////////////////////////////////////////////////////////////////////////// #define sign(n) ((n)<0?-1:((n)>0?1:0)) diff --git a/hphp/test/slow/ext_options/ext_options.php b/hphp/test/slow/ext_options/ext_options.php index e3125af05..2d917b653 100644 --- a/hphp/test/slow/ext_options/ext_options.php +++ b/hphp/test/slow/ext_options/ext_options.php @@ -36,3 +36,5 @@ var_dump(putenv("FOO=bar")); var_dump(!putenv("FOO")); var_dump(!version_compare("1.3.0.dev", "1.1.2", "<")); + +var_dump(version_compare(zend_version(), "2.4.99", ">=")); diff --git a/hphp/test/slow/ext_options/ext_options.php.expect b/hphp/test/slow/ext_options/ext_options.php.expect index ee20a94e8..4ef90f33b 100644 --- a/hphp/test/slow/ext_options/ext_options.php.expect +++ b/hphp/test/slow/ext_options/ext_options.php.expect @@ -20,3 +20,4 @@ string(14) "5.4.999-hiphop" bool(true) bool(true) bool(true) +bool(true)