Skip to content

Commit 5240f83

Browse files
committed
Fixed bug #80425
Rename the methods in MessageFormatAdapter to make sure they don't clash with anything defined by icu itself, which may be a problem if icu is linked statically.
1 parent ea372e7 commit 5240f83

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ PHP NEWS
1717
- Fileinfo:
1818
. Fixed bug #77961 (finfo_open crafted magic parsing SIGABRT). (cmb)
1919

20+
- Intl:
21+
. Fixed bug #80425 (MessageFormatAdapter::getArgTypeList redefined). (Nikita)
22+
2023
- Standard:
2124
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
2225
. Fixed bug #80411 (References to null-serialized object break serialize()).

ext/intl/msgformat/msgformat_helpers.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,26 @@ extern "C" {
4646

4747
U_NAMESPACE_BEGIN
4848
/**
49-
* This class isolates our access to private internal methods of
50-
* MessageFormat. It is never instantiated; it exists only for C++
51-
* access management.
49+
* ICU declares MessageFormatAdapter as a friend class of MessageFormat,
50+
* to use as a backdoor for accessing private MessageFormat members.
51+
* We use it for the same purpose here. Prefix the methods with php to
52+
* avoid clashes with any definitions in ICU.
5253
*/
5354
class MessageFormatAdapter {
5455
public:
55-
static const Formattable::Type* getArgTypeList(const MessageFormat& m,
56+
static const Formattable::Type* phpGetArgTypeList(const MessageFormat& m,
5657
int32_t& count);
57-
static const MessagePattern getMessagePattern(MessageFormat* m);
58+
static const MessagePattern phpGetMessagePattern(MessageFormat* m);
5859
};
5960

6061
const Formattable::Type*
61-
MessageFormatAdapter::getArgTypeList(const MessageFormat& m,
62+
MessageFormatAdapter::phpGetArgTypeList(const MessageFormat& m,
6263
int32_t& count) {
6364
return m.getArgTypeList(count);
6465
}
6566

6667
const MessagePattern
67-
MessageFormatAdapter::getMessagePattern(MessageFormat* m) {
68+
MessageFormatAdapter::phpGetMessagePattern(MessageFormat* m) {
6869
return m->msgPattern;
6970
}
7071
U_NAMESPACE_END
@@ -80,7 +81,7 @@ using icu::FieldPosition;
8081
U_CFUNC int32_t umsg_format_arg_count(UMessageFormat *fmt)
8182
{
8283
int32_t fmt_count = 0;
83-
MessageFormatAdapter::getArgTypeList(*(const MessageFormat*)fmt, fmt_count);
84+
MessageFormatAdapter::phpGetArgTypeList(*(const MessageFormat*)fmt, fmt_count);
8485
return fmt_count;
8586
}
8687

@@ -103,7 +104,7 @@ static HashTable *umsg_get_numeric_types(MessageFormatter_object *mfo,
103104
return mfo->mf_data.arg_types;
104105
}
105106

106-
const Formattable::Type *types = MessageFormatAdapter::getArgTypeList(
107+
const Formattable::Type *types = MessageFormatAdapter::phpGetArgTypeList(
107108
*(MessageFormat*)mfo->mf_data.umsgf, parts_count);
108109

109110
/* Hash table will store Formattable::Type objects directly,
@@ -288,7 +289,7 @@ static HashTable *umsg_get_types(MessageFormatter_object *mfo,
288289
{
289290
MessageFormat *mf = (MessageFormat *)mfo->mf_data.umsgf;
290291

291-
const MessagePattern mp = MessageFormatAdapter::getMessagePattern(mf);
292+
const MessagePattern mp = MessageFormatAdapter::phpGetMessagePattern(mf);
292293

293294
return umsg_parse_format(mfo, mp, err);
294295
}

0 commit comments

Comments
 (0)