com php-src: added PCRE JIT availability info to phpinfo(): ext/pcre/php_pcre.c ext/pcre/tests/check_jit_enabled .phpt
| From: | Anatol Belski | Date: | Sat, 07 Feb 2015 10:04:53 +0000 |
| Subject: | com php-src: added PCRE JIT availability info to phpinfo(): ext/pcre/php_pcre.c ext/pcre/tests/check_jit_enabled .phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84693@lists.php.net to get a copy of this message | ||
Commit: be718e45b0aa6a81e1c6f37b7bbdc30820f3c72b
Author: Anatol Belski <ab@php.net> Sat, 7 Feb 2015 11:04:53 +0100
Parents: 594c220dea0a1f3bd5e5d7fa72f8e5d00d0d2e6a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be718e45b0aa6a81e1c6f37b7bbdc30820f3c72b
Log:
added PCRE JIT availability info to phpinfo()
and a test to ensure it's enabled
Changed paths:
M ext/pcre/php_pcre.c
A ext/pcre/tests/check_jit_enabled.phpt
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index baf9941..c255fd9 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -132,9 +132,18 @@ PHP_INI_END()
/* {{{ PHP_MINFO_FUNCTION(pcre) */
static PHP_MINFO_FUNCTION(pcre)
{
+ int jit_yes = 0;
+
php_info_print_table_start();
php_info_print_table_row(2, "PCRE (Perl Compatible Regular Expressions) Support",
"enabled" );
php_info_print_table_row(2, "PCRE Library Version", pcre_version() );
+
+ if (!pcre_config(PCRE_CONFIG_JIT, &jit_yes)) {
+ php_info_print_table_row(2, "PCRE JIT Support", jit_yes ? "enabled" :
"disabled");
+ } else {
+ php_info_print_table_row(2, "PCRE JIT Support", "unknown" );
+ }
+
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
diff --git a/ext/pcre/tests/check_jit_enabled.phpt b/ext/pcre/tests/check_jit_enabled.phpt
new file mode 100644
index 0000000..9cdab2b
--- /dev/null
+++ b/ext/pcre/tests/check_jit_enabled.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Check for JIT enablement status
+--FILE--
+<?php
+
+ob_start();
+phpinfo();
+$info = ob_get_contents();
+ob_end_clean();
+
+var_dump(preg_match(",PCRE JIT Support .* enabled,", $info));
+?>
+--EXPECT--
+int(1)