Skip to content

Commit bd5247e

Browse files
committed
array_keys() with a string doesn't make sense.
This throws an exception specifically for strings, since this is likely accidental.
1 parent e2f9546 commit bd5247e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/laytonsmith/core/functions/ArrayHandling.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,8 @@ public Boolean runAsync() {
995995

996996
@Override
997997
public Construct exec(Target t, Environment env, Construct... args) throws ConfigRuntimeException {
998-
if (args[0] instanceof ArrayAccess) {
998+
// As an exception, strings aren't supported here. There's no reason to do this for a string that isn't accidental.
999+
if (args[0] instanceof ArrayAccess && !(args[0] instanceof CString)) {
9991000
ArrayAccess ca = (ArrayAccess) args[0];
10001001
CArray ca2 = new CArray(t);
10011002
for (Construct c : ca.keySet()) {

0 commit comments

Comments
 (0)