develooper Front page | perl.perl5.porters | Postings from May 2019

[perl #134140] Prevent use of characters above \xFF in bitwisestring ops

Thread Previous
From:
James E Keenan
Date:
May 25, 2019 02:13
Subject:
[perl #134140] Prevent use of characters above \xFF in bitwisestring ops
Message ID:
rt-4.0.24-28709-1558750388-729.134140-75-0@perl.org
# New Ticket Created by  James E Keenan 
# Please include the string:  [perl #134140]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=134140 >


pod/perldeprecation.pod contains this entry for perl-5.32:

#####
Use of code points over 0xFF in string bitwise operators

The string bitwise operators, "&", "|", "^", and "~", treat
their operands as strings of bytes. As such, values above
0xFF are nonsensical. Some instances of these have been
deprecated since Perl 5.24, and were made fatal in 5.28,
but it turns out that in cases where the wide characters
did not affect the end result, no deprecation notice was
raised, and so remain legal. Now, all occurrences either
are fatal or raise a deprecation warning, so that the
remaining legal occurrences will be fatal in 5.32.

An example of this is

"" & "\x{100}"

The wide character is not used in the "&" operation because
the left operand is shorter. This now warns anyway.
#####

This entry was made in the following commit:

#####
commit ba52ce15fe5ca68de1be69e394f41ccb48a731cc Author:
Karl Williamson <khw@cpan.org> Date: Tue Dec 19 16:03:39
2017 -0700

Deprecate above \xFF in bitwise string ops

This is already a fatal error for operations whose outcome
depends on them, but in things like

"abc" & "def\x{100}"

the wide character doesn't actually need to participate in
the AND, and so perl doesn't. As a result of the discussion
in the thread beginning with
http://nntp.perl.org/group/perl.perl5.porters/244884, it
was decided to deprecate these ones too.
#####

Make it so.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About