Weird behavior of volt 'length' filter on object

Hi Guys,

I'm using phalcon 2.1.0 RC1. Latest windows binary available on the blog.

Throw this in any volt file:

<?php $test = (object) array((object) array('test')); ?>
<?php var_dump(count($test)); ?>
<?php var_dump($this->length($test)); ?>
<?php var_dump(gettype($test)); ?>
<?php var_dump($test); ?>

The output is as follows:

int 1
int 0
string 'object' (length=6)
  public 0 => 
      public 0 => string 'test' (length=4)

Does anyone know why the volt filter is returning 0?

I don't see anything wrong with the function in zephir:

That looks weird. What php version you are using ?

edited Jun '16

I'm using PHP Version 5.6.14 x86 MSVC11

PHPinfo here: PHPinfo phalcon module: phalcon

edited Jun '16

This is also happening on PHP Version 5.5.36 by the way.


I guess this is related:

So it shouldn't really work properly in the first place. Only phalcon counts 0 instead of 1. I think I'll switch my code to use arrays.

Im guessing you right, just use array.