Skip to content

UCD.pm: Add check for parameter type #23301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: blead
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charclass_invlists.inc
Original file line number Diff line number Diff line change
Expand Up @@ -456662,7 +456662,7 @@ static const U8 WB_dfa_table[] = {
#endif /* defined(PERL_IN_REGEXEC_C) */

/* Generated from:
* b7f46fc1010fd83f5a678b268a23fef0142a18d0ab2a142edd0bb03328e667c3 lib/Unicode/UCD.pm
* cf66b466d4a521a5ee5891e1014fa33d51b0f2d9559e1ed5143917203e433ebf lib/Unicode/UCD.pm
* 764f420cedfc8b43d9fec251c957a5d55fc45d40f6573f162990ed1dce7e36e0 lib/unicore/ArabicShaping.txt
* b8f32554c6f658821fb0ee742d21c5b1f2086b9bf13071fed04894b022f93d67 lib/unicore/BidiBrackets.txt
* d7afdadd1bbd66f5a663ac0e8f7958f18fd9491fc0bc59ec5877cb82db71db7d lib/unicore/BidiMirroring.txt
Expand Down
4 changes: 3 additions & 1 deletion lib/Unicode/UCD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use warnings;
no warnings 'surrogate'; # surrogates can be inputs to this
use charnames ();

our $VERSION = '0.81';
our $VERSION = '0.82';

sub DEBUG () { 0 }
$|=1 if DEBUG;
Expand Down Expand Up @@ -2532,6 +2532,8 @@ change these into digits, and then call C<num> on the result.

sub num ($;$) {
my ($string, $retlen_ref) = @_;
croak __PACKAGE__, "::num: second parameter must be a scalar reference"
if defined $retlen_ref && ref $retlen_ref ne "SCALAR";

use feature 'unicode_strings';

Expand Down
7 changes: 7 additions & 0 deletions lib/Unicode/UCD.t
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,13 @@ is($ret_len, 5, "... and the returned length is 5");
ok(! defined num("98765\N{FULLWIDTH DIGIT FOUR}", \$ret_len),
'Verify num("98765\N{FULLWIDTH DIGIT FOUR}") isnt defined');
is($ret_len, 5, "... but the returned length is 5");
{
local $@;
my $ret_len = [ 5 ];
eval { num("98765", \$ret_len); };
like($@, qr/::num: second parameter must be a scalar reference/,
"num: Incorrect type for second parameter; must be scalar ref");
}
my $tai_lue_2;
if ($v_unicode_version ge v4.1.0) {
my $tai_lue_1 = charnames::string_vianame("NEW TAI LUE DIGIT ONE");
Expand Down
2 changes: 1 addition & 1 deletion lib/unicore/uni_keywords.pl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion regcharclass.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion regexp_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define MAX_FOLD_FROMS 3

/* Generated from:
* b7f46fc1010fd83f5a678b268a23fef0142a18d0ab2a142edd0bb03328e667c3 lib/Unicode/UCD.pm
* cf66b466d4a521a5ee5891e1014fa33d51b0f2d9559e1ed5143917203e433ebf lib/Unicode/UCD.pm
* 764f420cedfc8b43d9fec251c957a5d55fc45d40f6573f162990ed1dce7e36e0 lib/unicore/ArabicShaping.txt
* b8f32554c6f658821fb0ee742d21c5b1f2086b9bf13071fed04894b022f93d67 lib/unicore/BidiBrackets.txt
* d7afdadd1bbd66f5a663ac0e8f7958f18fd9491fc0bc59ec5877cb82db71db7d lib/unicore/BidiMirroring.txt
Expand Down
2 changes: 1 addition & 1 deletion uni_keywords.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading