On 05/25/18 22:24, Stuart Henderson wrote:
> On 2018/05/25 20:42, Martijn van Duren wrote:
>> Hello ports@,
>>
>> The following diff makes php's mbstring use the oniguruma package,
>> instead to the builtin. I also split it into a package, because it adds
>> another dependency. Mbstring still uses the builtin libmbfl, but that's
>> because we don't have it in a package. This shouldn't be too big of a
>> problem, since both these libraries appear to be up to date and if we
>> ever get it it's only a matter of updating the extension.
>
> NAK, but I'll reconsider if textproc/oniguruma starts getting maintained in ports.
> The dep is small enough that it's not really a problem as a dep of the main port though.
>
Now that oniguruma is up to date we can build PHP with it with the patch
below added to the previous patch. This change is taken from PHP7.2
which which uses 6.3.0. Considering oniguruma 6.3.0 fixes 6 CVEs, worth
the link? Else I'll drop it for now.
I did notice that mb_regex.c pulls in our oniguruma.h if installed,
which causes compiletime issues, so I reckon the patches below should go
in whether we link or not.
Only lightly tested with mb_ereg.
Index: 5.6/patches/patch-ext_mbstring_php_mbregex_c
===================================================================
RCS file: 5.6/patches/patch-ext_mbstring_php_mbregex_c
diff -N 5.6/patches/patch-ext_mbstring_php_mbregex_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 5.6/patches/patch-ext_mbstring_php_mbregex_c 27 May 2018 08:13:44 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: ext/mbstring/php_mbregex.c
+--- ext/mbstring/php_mbregex.c.orig
++++ ext/mbstring/php_mbregex.c
+@@ -454,7 +454,7 @@ static php_mb_regex_t *php_mbregex_compile_pattern(con
+ OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
+
+ found = zend_hash_find(&MBREX(ht_rc), (char *)pattern, patlen+1, (void **) &rc);
+- if (found == FAILURE || (*rc)->options != options || (*rc)->enc != enc || (*rc)->syntax != syntax) {
++ if (found == FAILURE || onig_get_options(rc) != options || onig_get_encoding(rc) != enc || onig_get_syntax(rc) != syntax) {
+ if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
+ onig_error_code_to_str(err_str, err_code, &err_info);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex compile err: %s", err_str);
Index: 7.0/patches/patch-ext_mbstring_php_mbregex_c
===================================================================
RCS file: 7.0/patches/patch-ext_mbstring_php_mbregex_c
diff -N 7.0/patches/patch-ext_mbstring_php_mbregex_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 7.0/patches/patch-ext_mbstring_php_mbregex_c 27 May 2018 08:13:44 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: ext/mbstring/php_mbregex.c
+--- ext/mbstring/php_mbregex.c.orig
++++ ext/mbstring/php_mbregex.c
+@@ -452,7 +452,7 @@ static php_mb_regex_t *php_mbregex_compile_pattern(con
+ OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
+
+ rc = zend_hash_str_find_ptr(&MBREX(ht_rc), (char *)pattern, patlen);
+- if (!rc || rc->options != options || rc->enc != enc || rc->syntax != syntax) {
++ if (!rc || onig_get_options(rc) != options || onig_get_encoding(rc) != enc || onig_get_syntax(rc) != syntax) {
+ if ((err_code = onig_new(&retval, (OnigUChar *)pattern, (OnigUChar *)(pattern + patlen), options, enc, syntax, &err_info)) != ONIG_NORMAL) {
+ onig_error_code_to_str(err_str, err_code, &err_info);
+ php_error_docref(NULL, E_WARNING, "mbregex compile err: %s", err_str);
No comments:
Post a Comment