Skip to content

Commit e5bd800

Browse files
author
foobar
committed
Fixed bug: php#11232. Now we require Fribidi 0.9.0.
# Better use the latest version for this one too since # it seems to have stabilized and they made an internal # rewrite for that one.
1 parent 7e34d46 commit e5bd800

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

ext/fribidi/config.m4

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
dnl $Id$
22
dnl config.m4 for extension fribidi
3-
dnl don't forget to call PHP_EXTENSION(fribidi)
4-
5-
63

74
PHP_ARG_WITH(fribidi, whether to add fribidi support,
85
[ --with-fribidi[=DIR] Include fribidi support (requires FriBidi >=0.1.12).
96
DIR is the fribidi installation directory -
107
default /usr/local/])
118

12-
13-
149
if test "$PHP_FRIBIDI" != "no"; then
1510

1611
dnl if module was requested with default path of fribidi installation then
@@ -19,8 +14,6 @@ dnl $PHP_FRIBIDI will be "yes"
1914
if test "$PHP_FRIBIDI" = "yes"; then
2015
PHP_FRIBIDI=/usr/local
2116
fi
22-
23-
2417

2518
dnl check for fribidi header files
2619

@@ -32,8 +25,6 @@ dnl $PHP_FRIBIDI will be "yes"
3225
AC_MSG_RESULT([missing])
3326
fi
3427

35-
36-
3728
dnl check for fribidi shared library
3829

3930
AC_MSG_CHECKING([for libfribidi.so file in "$PHP_FRIBIDI/lib/"])
@@ -54,20 +45,35 @@ dnl $PHP_FRIBIDI will be "yes"
5445
AC_MSG_RESULT([missing])
5546
fi
5647

48+
49+
dnl check for fribidi version
50+
AC_MSG_CHECKING([for FriBidi version])
51+
FRIBIDI_CONFIG=$PHP_FRIBIDI/bin/fribidi-config
52+
if test -x $FRIBIDI_CONFIG; then
53+
fribidi_version_full=`$FRIBIDI_CONFIG --version`
54+
fi
55+
56+
fribidi_version=`echo ${fribidi_version_full} | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
57+
58+
if test "$fribidi_version" -ge 9000; then
59+
AC_MSG_RESULT([$fribidi_version_full])
60+
else
61+
AC_MSG_ERROR(FriBidi version 0.9.0 or later is required to compile php with FriBidi support)
62+
fi
63+
5764

5865
AC_MSG_CHECKING([sanity to build extension])
5966
if test -n "$FRIBIDI_INCDIR" && test -n "$FRIBIDI_LIBDIR" && test -n "$GLIB_INCDIR"; then
6067

6168
AC_MSG_RESULT([yes])
62-
6369

6470
PHP_ADD_INCLUDE("$FRIBIDI_INCDIR")
6571
PHP_ADD_INCLUDE("$GLIB_INCDIR")
6672
PHP_ADD_LIBRARY_WITH_PATH(fribidi,"$FRIBIDI_LIBDIR", FRIBIDI_SHARED_LIBADD)
67-
PHP_SUBST(FRIBIDI_SHARED_LIBADD)
6873

6974
AC_DEFINE(HAVE_FRIBIDI, 1, [ ])
7075
PHP_EXTENSION(fribidi, $ext_shared)
76+
PHP_SUBST(FRIBIDI_SHARED_LIBADD)
7177
else
7278
AC_MSG_RESULT([no])
7379
fi

ext/fribidi/fribidi.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| obtain it through the world-wide-web, please send a note to |
1313
| license@php.net so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
15-
| Authors: |
15+
| Authors: Onn Ben-Zvi <onn@zend.com> |
1616
+----------------------------------------------------------------------+
1717
*/
1818

@@ -66,8 +66,8 @@ ZEND_GET_MODULE(fribidi)
6666
PHP_MINIT_FUNCTION(fribidi)
6767
{
6868
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_UTF8", FRIBIDI_CHARSET_UTF8, CONST_CS | CONST_PERSISTENT);
69-
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_6", FRIBIDI_CHARSET_8859_6, CONST_CS | CONST_PERSISTENT);
70-
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_8", FRIBIDI_CHARSET_8859_8, CONST_CS | CONST_PERSISTENT);
69+
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_6", FRIBIDI_CHARSET_ISO8859_6, CONST_CS | CONST_PERSISTENT);
70+
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_8", FRIBIDI_CHARSET_ISO8859_8, CONST_CS | CONST_PERSISTENT);
7171
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_CP1255", FRIBIDI_CHARSET_CP1255, CONST_CS | CONST_PERSISTENT);
7272
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_CP1256", FRIBIDI_CHARSET_CP1256, CONST_CS | CONST_PERSISTENT);
7373
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_ISIRI_3342", FRIBIDI_CHARSET_ISIRI_3342, CONST_CS | CONST_PERSISTENT);
@@ -108,13 +108,13 @@ PHP_MINFO_FUNCTION(fribidi)
108108
/* Possible values (i.e., char sets supported) */
109109
/* FRIBIDI_CHARSET_UTF8 */
110110
/* FRIBIDI_CHARSET_8859_6 */
111-
/* FRIBIDI_CHARSET_8859_8 */
112-
/* FRIBIDI_CHARSET_CP1255 */
113-
/* FRIBIDI_CHARSET_CP1256 */
114-
/* FRIBIDI_CHARSET_ISIRI_3342 */
111+
/* FRIBIDI_CHARSET_8859_8 */
112+
/* FRIBIDI_CHARSET_CP1255 */
113+
/* FRIBIDI_CHARSET_CP1256 */
114+
/* FRIBIDI_CHARSET_ISIRI_3342 */
115115
/* */
116116
/* Output: on success: The visual string. */
117-
/* on failure: */
117+
/* on failure: */
118118
/*--------------------------------------------------------------*/
119119

120120
/* {{{ proto string fribidi_log2vis(string str, string direction, int charset)
@@ -174,10 +174,10 @@ PHP_FUNCTION(fribidi_log2vis)
174174
case FRIBIDI_CHARSET_UTF8:
175175
utf8_len=fribidi_utf8_to_unicode(inString, u_logical_str);
176176
break;
177-
case FRIBIDI_CHARSET_8859_6:
177+
case FRIBIDI_CHARSET_ISO8859_6:
178178
fribidi_iso8859_6_to_unicode(inString, u_logical_str);
179179
break;
180-
case FRIBIDI_CHARSET_8859_8:
180+
case FRIBIDI_CHARSET_ISO8859_8:
181181
fribidi_iso8859_8_to_unicode(inString, u_logical_str);
182182
break;
183183
case FRIBIDI_CHARSET_CP1255:
@@ -211,10 +211,10 @@ PHP_FUNCTION(fribidi_log2vis)
211211
case FRIBIDI_CHARSET_UTF8:
212212
fribidi_unicode_to_utf8(u_visual_str, utf8_len , outString);
213213
break;
214-
case FRIBIDI_CHARSET_8859_6:
214+
case FRIBIDI_CHARSET_ISO8859_6:
215215
fribidi_unicode_to_iso8859_6(u_visual_str, len , outString);
216216
break;
217-
case FRIBIDI_CHARSET_8859_8:
217+
case FRIBIDI_CHARSET_ISO8859_8:
218218
fribidi_unicode_to_iso8859_8(u_visual_str, len , outString);
219219
break;
220220
case FRIBIDI_CHARSET_CP1255:

0 commit comments

Comments
 (0)