From 3ca75eca84b9d0987b69e271b2c50cae574df77e Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Fri, 21 Mar 2014 17:47:45 +0100 Subject: [PATCH] universal.c - utf8::downgrade($x,FAIL_OK) is not supposed to treat FAIL_OK as an integer --- pod/perldelta.pod | 9 +++++++++ universal.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 09401cbaf2..6c32a7b62f 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -208,6 +208,15 @@ Synchronize POD changes from the CPAN release. L has been upgraded from version 1.44 to 1.45. +=item * + +A mismatch between the documentation and the code in utf8::downgrade() +was fixed in favour of the documentation. The optional second argument +is now correctly treated as a perl boolean (true/false semantics) and +not as an integer. + +=item * + fork() in the debugger under C will now create a new window for the forked process. L<[perl #121333]|https://rt.perl.org/Ticket/Display.html?id=121333> diff --git a/universal.c b/universal.c index 65e02dfcce..777a924323 100644 --- a/universal.c +++ b/universal.c @@ -513,7 +513,7 @@ XS(XS_utf8_downgrade) croak_xs_usage(cv, "sv, failok=0"); else { SV * const sv = ST(0); - const bool failok = (items < 2) ? 0 : (int)SvIV(ST(1)); + const bool failok = (items < 2) ? 0 : SvTRUE(ST(1)) ? 1 : 0; const bool RETVAL = sv_utf8_downgrade(sv, failok); ST(0) = boolSV(RETVAL);