Issue #8585 has been reported by Haw Loeung.

----------------------------------------
Bug #8585: Arrays and undefined entries/elements
https://projects.puppetlabs.com/issues/8585

Author: Haw Loeung
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: arrays empty entry
Branch: 


Hi,

I'm having problems with checking undefined entries in an array. It looks like 
there may be a bug?


**Example code:**
<pre><code class="ruby">
$array = ["one", "two"]

if ($array[2] == '') {
        notice("Success: '${array[0]}' '${array[1]}' '${array[2]}' ")
} else {
        notice("FAILED: '${array[0]}' '${array[1]}' '${array[2]}'")
}

if ($array[2] =~ /^$/) {
        notice("Success: '${array[0]}' '${array[1]}' '${array[2]}' ")
} else {
        notice("FAILED: '${array[0]}' '${array[1]}' '${array[2]}'")
}
</code></pre>

**Expected output:**
<pre><code class="ruby">
notice: Scope(Class[main]): Success: 'one' 'two' ''
notice: Scope(Class[main]): Success: 'one' 'two' ''
</code></pre>

**Current Output:**
<pre><code class="ruby">
notice: Scope(Class[main]): FAILED: 'one' 'two' ''
notice: Scope(Class[main]): Success: 'one' 'two' ''
</code></pre>

>From the above, it seems that checking for an empty string fails yet a regex 
>check succeeds?


Regards,

Haw


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to