Skip to content

Commit e91d8ac

Browse files
committed
Add MB_ONIGURUMA_VERSION and use it in a version dependent test
1 parent d1c1481 commit e91d8ac

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

ext/mbstring/php_mbregex.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ void php_mb_regex_globals_free(zend_mb_regex_globals *pglobals)
105105
/* {{{ PHP_MINIT_FUNCTION(mb_regex) */
106106
PHP_MINIT_FUNCTION(mb_regex)
107107
{
108+
char version[256];
109+
108110
onig_init();
111+
112+
snprintf(version, sizeof(version), "%d.%d.%d",
113+
ONIGURUMA_VERSION_MAJOR, ONIGURUMA_VERSION_MINOR, ONIGURUMA_VERSION_TEENY);
114+
REGISTER_STRING_CONSTANT("MB_ONIGURUMA_VERSION", version, CONST_CS | CONST_PERSISTENT);
109115
return SUCCESS;
110116
}
111117
/* }}} */

ext/mbstring/tests/mb_ereg_variation3.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Test mb_ereg() function : usage variations - pass different character classes to
44
<?php
55
extension_loaded('mbstring') or die('skip');
66
function_exists('mb_ereg') or die("skip mb_ereg() is not available in this build");
7+
version_compare(MB_ONIGURUMA_VERSION, '6.1.0', '>=') or die("skip requires oniguruma >= 6.1.0");
78
?>
89
--FILE--
910
<?php

0 commit comments

Comments
 (0)