HomePhorge

(#6412) Return :undef when accessing non-existing hash/array elements
e9a5116f945aUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#6412) Return :undef when accessing non-existing hash/array elements

The truethiness test done in P::P::Scope.true? doesn't handle nil
values, because it is not valid as result of a puppet expression.
Unfortunately ruby hash['invalid'] or array[inexistant_index] returns
nil which then was considered as true in an if expression.
This patch makes sure :undef is returned in those cases.

Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>

Details

Provenance
Brice Figureau <brice-puppet@daysofwonder.com>Authored on
Jacob Helwig <jacob@puppetlabs.com>Committed on Dec 13 2011, 1:45 AM
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUad16096f97a5: Merge remote-tracking branch 'nicklewis/ticket/2.7rc/9671' into 2.7.x
Branches
Unknown
Tags
Unknown

Event Timeline

Jacob Helwig <jacob@puppetlabs.com> committed rPUe9a5116f945a: (#6412) Return :undef when accessing non-existing hash/array elements (authored by Brice Figureau <brice-puppet@daysofwonder.com>).Dec 13 2011, 1:45 AM