lib/knj/php.rb in knjrbfw-0.0.58 vs lib/knj/php.rb in knjrbfw-0.0.59

- old
+ new

@@ -900,11 +900,12 @@ #Foreach emulator. def foreach(element, &block) raise "No or unsupported block given." if !block.respond_to?(:call) or !block.respond_to?(:arity) arity = block.arity + cname = element.class.name.to_s - if element.is_a?(Array) + if element.is_a?(Array) or cname == "Array_enumerator" element.each_index do |key| if arity == 2 block.call(key, element[key]) elsif arity == 1 block.call(element[key]) \ No newline at end of file