We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Zephir: What value does a class variable get if it is not assigned a value at declaration?

In this case:

class Blah {

    protected static something;


Is the default value of something null?


probably, die(var_dump(self::something)); ?


I'm seeing lots of if something === null on undefined class variables in Phalcon code.

Trying to debug something. Just wondering


can you give me a link to check it and see if i can explain it ( eeventually )

edited Apr '17


There is some issue with MongoCollection in the Incubator with PHP 7.1. One of the issues is with the reserved words when saving. ref: here and here

In Phalcon\Mvc\Collection, the base class of MongoCollection, _reserved is declared on line 59: protected static _reserved; then tested later:

var reserved;

let reserved = self::_reserved;
if reserved === null {...

Been reading that Zephir tries to do type inference, so maybe _reserved gets [] instead of null.

That said, I am just now looking at Zephir.

Null i think.