From 86ae6e94ac83e2ce56c4363d483fee82c38cb7f9 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 7 Dec 2016 21:08:38 -0700 Subject: [PATCH] Die on malformed isFOO_utf8() input At the p5p core hackathon in November 2016, it was decided to make the previous deprecation message fatal for malformed input passed to the isFOO_utf8() macros and friends. --- pod/perldelta.pod | 3 ++- pod/perldiag.pod | 11 ----------- utf8.c | 14 +++++--------- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 99fb9c7..312252e 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -327,7 +327,8 @@ well. =item * -XXX +Calling macros like C on malformed UTF-8 have issued a +deprecation warning since Perl v5.18. They now die. =back diff --git a/pod/perldiag.pod b/pod/perldiag.pod index c0a717c..13cf13d 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -4671,17 +4671,6 @@ Remember that "my", "our", "local" and "state" bind tighter than comma. (F) Parsing code supplied by an extension violated the parser's API in a detectable way. -=item Passing malformed UTF-8 to "%s" is deprecated - -(D deprecated, utf8) This message indicates a bug either in the Perl -core or in XS code. Such code was trying to find out if a character, -allegedly stored internally encoded as UTF-8, was of a given type, such -as being punctuation or a digit. But the character was not encoded in -legal UTF-8. The C<%s> is replaced by a string that can be used by -knowledgeable people to determine what the type being checked against -was. If C warnings are enabled, a further message is raised, -giving details of the malformation. - =item Pattern subroutine nesting without pos change exceeded limit in regex (F) You used a pattern that uses too many nested subpattern calls without diff --git a/utf8.c b/utf8.c index 5268730..6b2c128 100644 --- a/utf8.c +++ b/utf8.c @@ -2425,16 +2425,12 @@ S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, * character without reading beyond the end, and pass that number on to the * validating routine */ if (! isUTF8_CHAR(p, p + UTF8SKIP(p))) { - if (ckWARN_d(WARN_UTF8)) { - Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED,WARN_UTF8), - "Passing malformed UTF-8 to \"%s\" is deprecated", swashname); - if (ckWARN(WARN_UTF8)) { /* This will output details as to the - what the malformation is */ - utf8_to_uvchr_buf(p, p + UTF8SKIP(p), NULL); - } - } - return FALSE; + _force_out_malformed_utf8_message(p, p + UTF8SKIP(p), + 0, + 1 /* Die */ ); + NOT_REACHED; /* NOTREACHED */ } + if (!*swash) { U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST; *swash = _core_swash_init("utf8", -- 1.8.3.1