Skip to content

Commit 0827b49

Browse files
committed
fixup! intl: report more information about message pattern parse errors
1 parent ab1aad7 commit 0827b49

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

ext/intl/msgformat/msgformat_format.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,17 +131,12 @@ PHP_FUNCTION( msgfmt_format_message )
131131
parse_error_str = intl_parse_error_to_string( &parse_error );
132132
spprintf( &msg, 0, "pattern syntax error (%s)", parse_error_str.s? ZSTR_VAL(parse_error_str.s) : "" );
133133
smart_str_free( &parse_error_str );
134+
134135
intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( mfo ) );
136+
intl_errors_set_custom_msg( INTL_DATA_ERROR_P( mfo ), msg, 1 );
135137

136-
if( msg != NULL )
137-
{
138-
intl_errors_set_custom_msg( INTL_DATA_ERROR_P( mfo ), msg, 1 );
139-
efree( msg );
140-
RETURN_FALSE;
141-
} else {
142-
intl_errors_set_custom_msg( INTL_DATA_ERROR_P( mfo ), "Unknown parser error", 0 );
143-
RETURN_FALSE;
144-
}
138+
efree( msg );
139+
RETURN_FALSE;
145140
}
146141

147142
INTL_METHOD_CHECK_STATUS(mfo, "Creating message formatter failed");

0 commit comments

Comments
 (0)