Skip to content

Instantly share code, notes, and snippets.

@fredemmott
Created February 28, 2014 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fredemmott/9262700 to your computer and use it in GitHub Desktop.
Save fredemmott/9262700 to your computer and use it in GitHub Desktop.
commit 0abae5f5aed48496e2a765b14fa301b093fe29d8
Author: Fred Emmott <fredemmott@fb.com>
Date: Thu Feb 27 16:21:46 2014 -0800
Add LIBXSLT_DOTTED_VERSION constant
Test Plan: new test
Reviewers: ptarjan, joelm
CC: smith, ps, hphp-diffs@lists
Differential Revision: https://phabricator.fb.com/D1195445
diff --git a/hphp/runtime/ext/ext_xsltprocessor.cpp b/hphp/runtime/ext/ext_xsltprocessor.cpp
index 9c33c6e..0b7abd8 100644
--- a/hphp/runtime/ext/ext_xsltprocessor.cpp
+++ b/hphp/runtime/ext/ext_xsltprocessor.cpp
@@ -10,7 +10,18 @@
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
-IMPLEMENT_DEFAULT_EXTENSION_VERSION(xsl, 0.1);
+const StaticString s_xslt_dotted_version("LIBXSLT_DOTTED_VERSION");
+const StaticString s_xslt_dotted_version_value(LIBXSLT_DOTTED_VERSION);
+
+class XslExtension : public Extension {
+ public:
+ XslExtension() : Extension("xsl", "0.1") { }
+ void moduleInit() {
+ Native::registerConstant<KindOfString>(s_xslt_dotted_version.get(),
+ s_xslt_dotted_version_value.get());
+ }
+};
+XslExtension s_xsl_extension;
void php_libxml_ctx_error(void *ctx,
const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
diff --git a/hphp/test/slow/xslt_version.php b/hphp/test/slow/xslt_version.php
new file mode 100644
index 0000000..ba67a86
--- /dev/null
+++ b/hphp/test/slow/xslt_version.php
@@ -0,0 +1,5 @@
+<?php
+// Explicit test as Composer depends on it
+
+var_dump(version_compare('1.1.0', LIBXSLT_DOTTED_VERSION));
+var_dump(version_compare('2.0.0', LIBXSLT_DOTTED_VERSION));
diff --git a/hphp/test/slow/xslt_version.php.expect b/hphp/test/slow/xslt_version.php.expect
new file mode 100644
index 0000000..d476426
--- /dev/null
+++ b/hphp/test/slow/xslt_version.php.expect
@@ -0,0 +1,2 @@
+int(-1)
+int(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment