]> granicus.if.org Git - php/commitdiff
added PCRE JIT availability info to phpinfo()
authorAnatol Belski <ab@php.net>
Sat, 7 Feb 2015 10:04:53 +0000 (11:04 +0100)
committerAnatol Belski <ab@php.net>
Sat, 7 Feb 2015 10:04:53 +0000 (11:04 +0100)
and a test to ensure it's enabled

ext/pcre/php_pcre.c
ext/pcre/tests/check_jit_enabled.phpt [new file with mode: 0644]

index baf9941764e82a003b92fe446b15b3e7ae5c8aeb..c255fd91740e0679dea9e9812ebee64eeda80a86 100644 (file)
@@ -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 (file)
index 0000000..9cdab2b
--- /dev/null
@@ -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)