From 888a67f6b9560370131905c2de5886e48f126644 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 17 Feb 2013 06:07:59 +1300 Subject: [PATCH] mg.c : revert ENV{x} = undef behaviour to be empty string, not key deletion pod/perldelta.pod: document reversion of ENV{foo} = undef behaviour in delta t/op/magic.t: add a test for ENV{foo} = undef --- mg.c | 2 +- pod/perldelta.pod | 7 +++++++ t/op/magic.t | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/mg.c b/mg.c index e4711e7..6811727 100644 --- a/mg.c +++ b/mg.c @@ -1101,7 +1101,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg) dVAR; STRLEN len = 0, klen; const char * const key = MgPV_const(mg,klen); - const char *s = NULL; + const char *s = ""; PERL_ARGS_ASSERT_MAGIC_SETENV; diff --git a/pod/perldelta.pod b/pod/perldelta.pod index b50885e..c89f644 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -53,6 +53,13 @@ XXX For a release on a stable branch, this section aspires to be: If any exist, they are bugs, and we request that you submit a report. See L below. +=head2 C<$ENV{foo} = undef> no longer deletes value from environ + +5.17.3 Introduced a change where assiging C to an C<%ENV> key was equivalent +to C. + +This release reverts that change. + [ List each incompatible change as a =head2 entry ] =head1 Deprecations diff --git a/t/op/magic.t b/t/op/magic.t index 990de55..5421d01 100644 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -5,7 +5,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - plan (tests => 178); + plan (tests => 179); } # Test that defined() returns true for magic variables created on the fly, @@ -647,9 +647,13 @@ SKIP: { } $ENV{__NoNeSuCh} = 'foo'; + $ENV{__NoNeSuCh2} = 'foo'; $0 = 'bar'; env_is(__NoNeSuCh => 'foo', 'setting $0 does not break %ENV'); + $ENV{__NoNeSuCh2} = undef; + env_is(__NoNeSuCh2 => '', 'setting a key as undef does not delete it'); + # stringify a glob $ENV{foo} = *TODO; env_is(foo => '*main::TODO', 'ENV store of stringified glob'); -- 2.7.4